CommonSpot ADF’s renderScriptOnce method

A tiny green sprout with a single leaf pokes up out of an otherwise dead houseplant.

A problem common across many CMS platforms is managing the loading of third-party JavaScripts, such as JWPlayer. You could make them available for any page in your website by including them in a global header or footer, but that approach is lazy and wastes bandwidth. A better approach is to include third-party JavaScripts on only the pages where they will be used.

For example, pages with embedded videos get the JWPlayer linking, but the pages lacking videos do not. This is fairly straightforward– just include the third-party JavaScript in the output of the plugin, render handler, etc. with which it is associated (i.e. your video element/plugin links to the JWPlayer script).

But what if a page has multiple instances of that video element/plugin?

Continue reading “CommonSpot ADF’s renderScriptOnce method”