Preventing Duplicate JavaScript Libraries In HTML Fragments
We used a UDF to check if jQuery was already included in the output stream, loading it only when necessary. Compatible with Adobe ColdFusion, Railo and Lucee CFML.
In one of our projects about 10 years ago, we were fetching HTML fragments from a trusted third-party for inclusion on the website. Instead of using an iFrame or incorporating ajax, which could negatively impact our SEO, we would occasionally fetch the content in the background and update the webpage. While this approach worked fine, there were times when the fragments would contain some inline JavaScript, but wouldn't work because the JavaScript library wasn't loaded... or if loaded within the HTML fragment would cause a problem because now the JS library is being loaded more than once. To w...