XF 1.5 Jquery loaded twice?

Fred.

Well-known member
Hi,

As jQuery Source I have selected
  • Google Ajax API CDN
GTmetrix told me jQuery is loaded twice from different url's. I can confirm that if I check my page source.

It loads jQuery from this url's.

//myCDNaccount.netdna-ssl.com/js/jquery/jquery-1.11.0.min.js
//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js

The first one comes from this code in page_container_js_head
Code:
<script src="{$jQuerySource}"></script>
    <xen:if is="{$jQuerySource} != {$jQuerySourceLocal}">
        <script>if (!window.jQuery) { document.write('<scr'+'ipt type="text/javascript" src="{$jQuerySourceLocal}"><\/scr'+'ipt>'); }</script>
    </xen:if><xen:if is="{$xenOptions.uncompressedJs} == 1 OR {$xenOptions.uncompressedJs} == 3">
    <script src="{$javaScriptSource}/jquery/jquery.xenforo.rollup.js?_v={$xenOptions.jsVersion}"></script></xen:if>   
    <script src="{xen:helper javaScriptUrl, '{$javaScriptSource}/xenforo/xenforo.js?_v={$xenOptions.jsVersion}'}"></script>
and shows this in the source code
Code:
<script>if (!window.jQuery) { document.write('<scr'+'ipt type="text/javascript" src="https://myCDNaccount.netdna-ssl.com/js/jquery/jquery-1.11.0.min.js"><\/scr'+'ipt>'); }</script>

The second seems the right one from Google Ajax API CDN

That one is loading with all the javascripts
Code:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

How can I fix this so only the one from Google Ajax API CDN is loaded?

Thanks! :-)
 
and shows this in the source code
Code:
<script>if (!window.jQuery) { document.write('<scr'+'ipt type="text/javascript" src="https://myCDNaccount.netdna-ssl.com/js/jquery/jquery-1.11.0.min.js"><\/scr'+'ipt>'); }</script>
This is expected. It isn't actually loading it twice. The code basically says "If jQuery hasn't loaded, load it from the local source". It's simply a back up in case jQuery isn't loaded properly from the external source.
 
Top Bottom