On-Demand Javascript

Tags:

On-Demand Javascript

Download Javascript as and when required, instead of downloading it all on page load. This is a “lazy loading” approach applied to Javascript, and has several benefits:

-Initial page load is faster.
– Overall bandwidth usage is less, since only Javascript that’s required is used.
– Deployment is easier as the code takes care of pulling in Javascript, with the coder only ensuring enough is there to kick the process off.
– You can produce snippets of Javascript on the fly – effectively sending back a kind of “behaviour message” advising the browser on its next action.
– This is a variant of the core pattern described at the end of this section.
– You can bypass the standard “same-domain” policy that normally necessitates a [[Cross-Domain Mediator]. Provided a server exposes a segment of valid Javascript, it can be extracted by the browser.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *