SNJS External Scripts

Developers using SNJS can also include external javascript files using the src attribute of the <script> tag.

Though using the external javascript files has the overhead of fetching these files from the remote server, these files are parsed, sanitized and cached both on the browser and on our server. Hence any subsequent requests for these files will be fast. Inlined javascript is parsed and sanitized for each page request.

We recommend that developers who are making heavy use of javascript in their applications to consider using external javascript files to speed up their applications.

Here are some guidelines for using this feature:

  • External javascript files can only be included on canvas pages. For application profile modules, developers will have to use inlined javascript.
  • A maximum of 5 external javascript files per canvas page can be used.
  • Each external javascript file can be atmost 512K bytes.
  • If the contents of the javascript file are changed, you should update the url with a version number to ensure that users get the most upto date version. For example you can change the url from http://www.myapps.com/app.js?v=1.0 to http://www.myapps.com/apps.js?v=2.0