简体   繁体   中英

Google jQuery from CDN with SSL - Issues with iPad

Since updating my iPad the other day and testing a new website on it, I soon realised that jQuery was not working throughout my application, but is working fine everywhere else (desktop browsers etc).

After a couple of hours trying to debug my code, I simply built a blank page and included the following:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<script>
    if (window.jQuery) {  
        alert("jQuery loaded");
    } else {
        alert("jQuery NOT loaded");
    }

    $(document).ready(function(e) {
        alert("DOM ready.");
    });
</script>

On my desktop machine I get two alerts; "jQuery loaded" and "DOM ready". On my iPad I get only one alert; "jQuery NOT loaded".

I then found the changing HTTPS://ajax.googleapis.com... to HTTP://ajax.googleapis.com... makes it load without any problems.

What am I missing here? Has anything changed recently that would cause this? I'd like to use HTTPS throughout my application, so I need to fix this/learn from it really. Any help of experience gratefully received.

Try changing this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js">
</script>

to this:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js">
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM