This request has been blocked; the content must be served over HTTPS
18,084
Just change the http://
in your url variable to //
, so when the page is loaded with http, the ajax request would use the http protocol, if loaded with https, the ajax request protocol would be set by the browser to https. i.e, your code should look like:
$.ajax({
url : "//example.com/non-https",
..
..
Author by
Amy Johnson
Updated on June 14, 2022Comments
-
Amy Johnson almost 2 years
I try to do ajax, my code written on a https site it request to non https, but the resources were blocked by Chrome.
$.ajax({ url : "http://example.com/non-https", .. ..
Previously in earlier version I don't have this issue. Must my ajax request target a https too? Or there is a better way to save that problem?