Load jQuery CDN

501 views
Skip to first unread message

sala...@gmail.com

unread,
Feb 10, 2015, 10:17:37 AM2/10/15
to gwd...@googlegroups.com
Hello,

I need to load jQuery in a banner I'm working on. This is the code I currently have:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
window.jQuery || document.write('<script type="text/javascript" src="jquery-1.7.2.min.js"><\/script>')
</script>

I first try to load the library from a CDN and if that is not possible I look for the local version. When I publish the banner the copy of jQuery is not exported.

Should I just call the library as a local resource so GWD include it on the build? I understand I have to include any external documents I use on the banner, even if it's on a CDN, is this correct?

Thanks for your help.

Kishore Subramanian

unread,
Feb 10, 2015, 7:33:25 PM2/10/15
to gwd...@googlegroups.com
Hi,

I am not sure I understand the question correctly. Can you open the published index.html and see if jquery is included inline in the HTML file?

During publish, GWD optimizes the output by inlining the local .js and .css files in the HTML document. This is done to prevent multiple HTTP requests. The inlining is skipped for scripts served from an external web server or CDN. So the script to load jquery.min.js from the CDN should left intact in the published document.

Kishore
Reply all
Reply to author
Forward
Message has been deleted
0 new messages