RoverDar RoverDar - 1 year ago 269
HTTP Question

Jquery load https url

I have this problem. In external web site I have a script like this:

<div id="idtest"></div>
<script src="//" type="text/javascript"></script> is in https (allow both http and https). In the server in the script widget.js I have:


I get this error: Mixed Content: The page at 'thepage' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ''. This request has been blocked; the content must be served over HTTPS.

I don't understand: why the error and why the endpoint is in "http"?


More information:

if in the widget.js I do this:


the content is load and all works perfectly if I load the script in my site.

If I do something like:

x = ""
$('#idtest').load(x + "/index.html")



I get the error (if I put the script in my site or in external site). Why?


more informations:

my site is in django


In firefox I load the page in https and http. It doesn't work in Chrome. I see this situation in firefox net analyzer when call the url :

200 [mixed content]

What understand this situation (https to http)? Could be a Django redirect problem?

Answer Source

A mixed content error happens when:

  • you try to load secure content SSL(https) on a page served insecurely (http) served

Or the opposite

  • you try to load insecure content (http) on a page served securely SSL(https) served

Your error message is warning that your calling page has been loaded in insecure mode

You haven't explicitly explained this, but your error indicated your page is being served without SSL. When you try to load a protected resource this becomes a mixed mode problem of protected resources and insecure.

If possible, you try to serve the reference file the same way


  • Just as you have resolved it, request the partial page without protocol. Now your loaded file will be loaded using the protocol used by your page.

About your specific resource:

I tried loading:


The result was the same. I got a simple page with the message:

Example Domain

This domain is established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.

More information...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download