cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mobicycle
Resolver I
Resolver I

Upload a large JavaScript file to Portals?

How do I upload a large JavaScript file to Portals (Web Files or similar)?

1 ACCEPTED SOLUTION

Accepted Solutions
mobicycle
Resolver I
Resolver I

There is a problem with the platform whereby the upload feature does not always work.

 

Solution: Try uploading the js file to Notes in a Web File via a different browser.

View solution in original post

23 REPLIES 23
Manar
Super User
Super User

Hi @mobicycle ,

is it a react file? if not then there are multiple ways to do that depending on your use case, the most recommended way is to use snippets (chop your codes into features and call them in the web page js section or web template)

Thank you,
Manar

If you like this post, give it aThumbs Up. Where it solved your query, mark it as a SOLUTION so it can help other people!

It is a large (vanilla) javascript file. How do I upload a large javascript file?

Manar
Super User
Super User

@mobicycle  then web file is your choice. In one project we needed to use react so we built everything in VS , complied it in one js file then and upload it as app.js as web file 

Thank you,
Manar

If you like this post, give it aThumbs Up. Where it solved your query, mark it as a SOLUTION so it can help other people!

I tried again to save the contents of my large javascript file as a content snippet and it worked. 

 

ManarAlnuaimi
New Member

-

Perfect @mobicycle , you probably know that but you can call it in any place that accept html like web page using below codes

 

{% include 'snippet' snippet_name:'YourSnippetName' %}

 

Manar_0-1641923191190.png

 

Please mark it as accepted solution so others can benefit from it as well !

Thank you,
Manar

If you like this post, give it aThumbs Up. Where it solved your query, mark it as a SOLUTION so it can help other people!

So, to be clear

 

We are saying that javascript files of all sizes can be saved to Content Snippets?

 

And after saving the js file to a new Content Snippet, one should add the file to the Web Page via the following

{% include 'snippet' snippet_name:'YourSnippetName' %}

 

What about Web Files? or Child Pages?

 

Why does the Content Snippet offer only "Text" or "HTML"?

 

It seems the logical place for a JS file would be as a Web File.

 

At present, uploading a large JS file as a Web File creates the following error

You have exceeded the maximum number of characters in this field. 

 

I also do not see an upload button within the Notes section of Web Files.

 

A web file represents downloadable file in a portals website, used to store images, documents, and any other file type.

 

Create and manage web files - Power Apps | Microsoft Docs

Manar
Super User
Super User

@mobicycle  thats right , so think about it as 2 options to deal with large js:

1- use content snippet, to call it use {% include 'snippet' snippet_name:'YourSnippetName' %}  anywhere html is supported 

2- use web file , to call it use <script type="text/javascript" src="/YourJSFileName.js"> </script> anywhere html is supported 

Manar_1-1641927086143.png

ref this useful video Min 14 and after

https://www.youtube.com/watch?v=vABWmnZQYQA 

 

 

Thank you,
Manar

If you like this post, give it aThumbs Up. Where it solved your query, mark it as a SOLUTION so it can help other people!

Ok, so that is how to call the file.

 

How does one upload a large js file to Web Files without encountering an error?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel News & Announcements 768460.png

What's New in the Community?

Check out the latest News & Events in the community!

MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Users online (3,373)