How do I upload a large JavaScript file to Portals (Web Files or similar)?
Solved! Go to Solution.
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.
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)
It is a large (vanilla) javascript file. How do I upload a large javascript file?
@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
I tried again to save the contents of my large javascript file as a content snippet and it worked.
-
Perfect @mobicycle , you probably know that but you can call it in any place that accept html like web page using below codes
Please mark it as accepted solution so others can benefit from it as well !
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.
@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
ref this useful video Min 14 and after
https://www.youtube.com/watch?v=vABWmnZQYQA
Ok, so that is how to call the file.
How does one upload a large js file to Web Files without encountering an error?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
6 | |
4 | |
2 | |
1 | |
1 |