This request has been blocked; the content must be served over HTTPS

前端 未结 1 1322
Happy的楠姐
Happy的楠姐 2021-01-12 15:45

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({
                ur         


        
1条回答
  •  鱼传尺愫
    2021-01-12 15:47

    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",
    ..
    ..
    

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