问题
How can I fix this in my PHP page that contains ad scripts?
I have added scripts. It worked fine in HTTP but after I switched my site to HTTPS, nothing is appearing.
This is the error in dev console:
Failed to load resource: the server responded with a status of 404 (Not Found) index.php:1
Mixed Content: The page at
'https://myrevenuebank.com/index.php'
was loaded over HTTPS, but requested an insecure script'http://resources.infolinks.com/js/infolinks_main.js'
. This request has been blocked; the content must be served over HTTPS.
<script type="text/javascript">
var infolinks_pid = 2735394;
var infolinks_wsid = 0;
</script>
<script type="text/javascript" src="http://resources.infolinks.com/js/infolinks_main.js"></script>
回答1:
click View > Developer > JavaScript Console. Send us what errors you have in developer Console. try to use https rather than http in script link. also you can try to download the script and put it in your server.
- you have 404 on menu.css (missing file)
- you are loading http script from https website. change http://resources.infolinks.com/js/infolinks_main.js to https://resources.infolinks.com/js/infolinks_main.js
回答2:
The reason is because browsers will block insecure content when accessing a secure page unless the user specifically allows that content.
You are trying to access http://resources.infolinks.com/js/infolinks_main.js
from a secure connection, but that will not work. Instead change the URL to //resources.infolinks.com/js/infolinks_main.js
without the protocol.
Note: This will only work for things that can be accessed using exactly the same URL with both http
and https
, which is the case here. If the script is only available over http
, you will not be able to access it via https
and you would have to save it on your server instead of loading it from a remote server.
来源:https://stackoverflow.com/questions/36898894/how-to-fix-page-trying-to-load-scripts-from-unauthenticated-source