Skip to content
thepian edited this page Oct 5, 2012 · 4 revisions

The default way for a script to be loaded into the page is while the page is being loaded. Regular HTML script tags are loaded one at a time as the page progresses loading.

Using EssentialJS other options are,

  • After page load (pastload)
  • After user authenticated (pastuser)
  • Before other after page load scripts (preload)

To use one of these options add a link element,

<link src="js/knockout.js" rel="pastload" type="text/javascript">

The script will be loaded by a dynamically added script tag. The script will be monitored and the page launching will be postponed until the script is loaded.

Language dependence

If you have a script for a specific locale, add a lang attribute. The Page State Language will determine if the script is loaded.

<link src="en/translations.js" lang="en" rel="preload" type="text/javascript">
<link src="de/translations.js" lang="de" rel="preload switch" type="text/javascript">

If the language is changed after the page is loaded the alternate script can be loaded and run if you add switch to the rel attribute.

Clone this wiki locally