Hi Everyone, just wanted to share a trick I recently learned, which has * significantly* increased the loading speed of my exhibits - the HTML 5 "defer" attribute.
I now load my Exhibit Scripts like so: <script *defer *type="text/javascript" src="http://api.simile-widgets.org/exhibit/2.2.0/exhibit-api.js"> A full explanation of the method here: http://webkit.org/blog/1395/running-scripts-in-webkit/ *Normally when the parser encounters an external script, parsing is paused, a request is issued to download the script, and parsing is resumed only after the script has fully downloaded and executed. ** During the download the browser is blocked from doing other useful work, such as parsing HTML, executing other scripts and performing layout.* *Both async and defer scripts begin to download immediately without pausing the parser and both support an optional onload handler to address the common need to perform initialization which depends on the script. The difference between async and defer centers around when the script is executed. Each async script executes at the first opportunity after it is finished downloading and before the window’s load event. This means it’s possible (and likely) that async scripts are not executed in the order in which they occur in the page. The defer scripts, on the other hand, are guaranteed to be executed in the order they occur in the page. That execution starts after parsing is completely finished, but before the document’s DOMContentLoaded event.* Hope you find it useful! Regards, Jon -- You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en.
