http-jquery在https上不起作用

http jquery not working on https

本文关键字:不起作用 https http-jquery      更新时间:2023-09-26

我在中添加了以下配置

<httpProtocol>
    <customHeaders>
        <add name="access-control-allow-headers" value="content-type" />
        <add name="Access-Control-Allow-Origin" value="*" />
    </customHeaders>
</httpProtocol>

我在aspx文件中使用以下脚本

 <script type="text/javascript" src="//registeriq.com/js/jquery.min.js"></script>

我们有两个服务器用于一个web应用程序。一种使用http,另一种使用https。

以上脚本仅适用于http服务器。它在使用https协议的服务器上不起作用。我还注意到,系统会自动在https服务器上的//registeriq.com/js/jquery.min.js上添加https。。。

请帮帮我。

您通过使用//in:使用相对路径

<script type="text/javascript" src="//registeriq.com/js/jquery.min.js">   </script>

这意味着当安全访问页面(通过https)时,浏览器会自动为您的资源添加https前缀。

通过打开https://registeriq.com/js/jquery.min.js在浏览器中,你会注意到你会得到一个错误。这意味着它不是通过HTTPS提供的。

您可以使用http使用absolute,但通过HTTPs访问页面的浏览器将显示警告。

例如

<script type="text/javascript" src="http://registeriq.com/js/jquery.min.js">   </script>

编辑:

对于任何发现此问题的人,请参阅https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content了解更多信息。

在上述情况下,他的应用程序通过HTTPs提供服务,但registeriq.com没有HTTPs。

浏览器不允许在https站点中放置http链接你可以使用这个;

<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js">   </script>