http content on a https page - Mixed content

后端 未结 2 1775
夕颜
夕颜 2020-12-20 04:52

I was wondering how I should do this.

I have some https pages, but need to call in some http content from my CDN provider.
The content I am wanting to load via h

相关标签:
2条回答
  • 2020-12-20 05:40

    If you want to use a CDN, you'll need one that supports HTTPS unfortunately.

    Google Libraries provides a number of well-known libraries (e.g. jQuery) over HTTPS.

    0 讨论(0)
  • 2020-12-20 05:52

    I know this has already had an answer accepted, but I think the following is a better solution:

    Try using protocol-less Urls.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
    

    You can do the same with CSS:

    <link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.20/themes/base/jquery.ui.core.css" type="text/css" rel="stylesheet" />
    

    Note the lack of https or http in the urls. The browser will determine the appropriate protocol. No more mixed content warnings / errors.

    0 讨论(0)
提交回复
热议问题