web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : K05XBifnqwE1taJiVWdpeb
Power Pages - Design & Build
Answered

What is the most reliable way to add Javascript?

Like (0) ShareShare
ReportReport
Posted on 15 Feb 2024 17:05:13 by 264 Moderator

I hit the 10000 Javascript character limit, also trying to use both basic forms and multistep forms, so very inconvenient to have to look for the Javascript in different places

 

In this post, I read that by adding a 'nosniff' it affects the Web File that was added as Javascript Solved: PowerApps Portal: Storing JavaScripts in web files - Power Platform Community (microsoft.com)  -

 

This makes me wonder whether Web Files is a reliable way of adding files (I'm aware we have to 'fool' the system as it won't allow a direct .js upload)

 

Where can I add the Javascript safely, so it won't incur problems further down the line? Our website will be externally tested, so nosniff is already in place

 

I'm not able to use the Blob storage although it sounds like a great option

 

I believe I read elsewhere you could add it in Webpage, Webfile, I can't find all the steps in writing, can someone please list them thoroughly? Thank you

  • Zaid-Aboobaker Profile Picture
    on 26 Jun 2024 at 15:28:24
    Re: What is the most reliable way to add Javascript?

    Scrap that it worked. I just needed some patience.

  • Zaid-Aboobaker Profile Picture
    on 26 Jun 2024 at 14:22:57
    Re: What is the most reliable way to add Javascript?

    Hi Guys. I tried to follow this solution with no luck.

     

    I have hit the 10k limit for an advanced form. I removed all the code from the advanced form step and I have created a webfile, and uploaded the note ( javascript code). I have added to the page, the section 

    script.. type="text/javascript" src="~/cgictpf-policy.js">...script.

     

    I have changed the security settings to allow .js files.

     

    The code is not working on the advanced form step.

     

    Am i missing something from this solution? 

  • inanoffice23 Profile Picture
    264 Moderator on 26 Feb 2024 at 18:08:54
    Re: What is the most reliable way to add Javascript?

    AMAZING!!! Thank you so much @EmadBeshai it has certainly fixed it! I added a JS with over 12k characters, such a simple solution, I knew it was possible somehow! 

     

    I now have 2 big issues to solve before I can deliver my project, hope I can get it working, it's been 5 months and starting to look bad on me 😞 

     

    Thank you once again, you are a life saver! :))) 

  • Verified answer
    EmadBeshai Profile Picture
    806 Moderator on 26 Feb 2024 at 17:21:17
    Re: What is the most reliable way to add Javascript?

    Hi @inanoffice23 ,

    From the Default solution look for the form step table as I elaborated in the above screenshot.

    I'm already using this trick in my projects.

    Please let me know if you more help.

    If this post helps you with your problem, please mark this answer as Accepted Solution.
    If you like my response, please give it a Thumbs Up. 

     

  • inanoffice23 Profile Picture
    264 Moderator on 26 Feb 2024 at 10:04:31
    Re: What is the most reliable way to add Javascript?

    Wow! I think that might fix the issue @EmadBeshai ! How did you get the form step to show up in the objects section though? I have been looking to 'add existing' but I can't seem to find how to do that

     

    I do wonder whether the 10000 character limit is there for a reason, or just as a default, this article says multiline columns maximum is 1048576 so in theory good to go as long as I find the magic column 🙂 Column data types in Microsoft Dataverse (contains video) - Power Apps | Microsoft Learn

  • EmadBeshai Profile Picture
    806 Moderator on 25 Feb 2024 at 10:08:12
    Re: What is the most reliable way to add Javascript?

    Hi @inanoffice23 ,

     

    You can increase the JS field limit from the dataverse a shown below 

    EmadBeshai_0-1708855682209.png

    If this post helps you with your problem, please mark this answer as Accepted Solution.
    If you like my response, please give it a Thumbs Up. 

  • inanoffice23 Profile Picture
    264 Moderator on 23 Feb 2024 at 10:51:41
    Re: What is the most reliable way to add Javascript?

    Thank you @JadyMulqueeney I guess the step missing is go to the copy.HTML and add this piece of code 

    <script type="text/javascript" src="~/test.js"></script> so it can read the JS

     

    I will come back to this post once I find out if IT allows us to have Web files and render JS properly

  • Jady Profile Picture
    134 on 22 Feb 2024 at 00:23:00
    Re: What is the most reliable way to add Javascript?

    To upload a JS file into your Power Pages Web Files, you will need to enable JS filetype for upload. 

    • Enable via File Types in "Company Settings"
    • By default, JS files are blocked

    From Settings > Admin Center, go to https://admin.powerplatform.microsoft.com/environments

    • Select your environment
    • Open Settings for that environment
    • Under Products, open Privacy + Security
    • Remove JS from "Blocked Attachments" > "Block these file extensions" field.

    (Doesn't hurt to also enable SVG, if you are planning to upload any SVG files)

  • inanoffice23 Profile Picture
    264 Moderator on 21 Feb 2024 at 16:19:34
    Re: What is the most reliable way to add Javascript?

    Thank you for your reply @Fubar 

     

    I guess for now I will stick to attempting to use Web Files and see whether the IT Test has any objections further down the line, I might update the answer once I find out (it will probably take months)

  • Fubar Profile Picture
    8,058 Super User 2025 Season 2 on 20 Feb 2024 at 22:01:47
    Re: What is the most reliable way to add Javascript?

    Unfortunately, low/no code only really applies to simplistic implementations.

     

    There are places by design to hold JS, and then also maybe some workarounds, places you can put JavaScript are generally

    Also, note not all features are in the site editor, so somethings are still only available in the Management App.

    The Argument you can make for JS in different places, is a) in many cases it is by design, b) it is all in the Dataverse instance, c) if you are using the CLI or the Pages Solutions it is all there.  

    The rest just comes down to the experience of the people working on it and them knowing where to expect to find stuff.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#2
Lucas001 Profile Picture

Lucas001 48 Super User 2025 Season 2

#3
KevinGador Profile Picture

KevinGador 44 Super User 2025 Season 2

Featured topics

Loading complete