简体   繁体   English

来自CDN的Google jQuery与SSL - iPad的问题

[英]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). 自从前几天更新我的iPad并在其上测试一个新网站后,我很快意识到jQuery在我的应用程序中无法正常工作,但在其他任何地方(桌面浏览器等)都能正常工作。

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". “jQuery loaded”和“DOM ready”。 On my iPad I get only one alert; 在我的iPad上,我只收到一个警报; "jQuery NOT loaded". “jQuery没有加载”。

I then found the changing HTTPS://ajax.googleapis.com... to HTTP://ajax.googleapis.com... makes it load without any problems. 然后我发现更改HTTPS://ajax.googleapis.com...HTTP://ajax.googleapis.com...使其加载没有任何问题。

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. 我想在我的应用程序中使用HTTPS,所以我需要解决这个问题/从中学习它。 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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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