Skip to content

Instantly share code, notes, and snippets.

@mrandrewmills
Last active November 9, 2016 13:45
Show Gist options
  • Save mrandrewmills/cccb2878b83a5d293995ba13fedd120a to your computer and use it in GitHub Desktop.
Save mrandrewmills/cccb2878b83a5d293995ba13fedd120a to your computer and use it in GitHub Desktop.
Example using CommonSpot ADF renderScriptOnce method to load JWPlayer once and only once
<cfsavecontent variable="outputHTML">
<cfoutput>
<script type="text/javascript" src="/common/commonspot/templates/js/jwplayer/jwplayer.js"></script>
<script type="text/javascript">jwplayer.key="PUT_YOUR_API_KEY_HERE_OBVIOUSLY";</script>
</cfoutput>
</cfsavecontent>
<cfoutput>
#application.adf.scriptsService.renderScriptOnce("JWPlayer", outputHTML)#
</cfoutput>
@mrandrewmills
Copy link
Author

It's worth mentioning, if you're using CommonSpot 10, there's a menu option within the Site Admin for registering Libraries and Resources that may make this approach redundant and unnecessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment