SSL site won't load non-SSL scripts from other

2019-03-06 09:07发布

问题:

I have a website with SSL (https instead of http). I am attempting to embed a widget that references files (js, css) from another domain. This other domain does not have SSL (http instead of https). As a result, I get an net::ERR_INSECURE_RESPONSE and the widget will not load.

How can I tell my site to allow the insecure content used by the widget?

回答1:

You cannot tell a website to allow insecure content in the page as it is not the site that is blocking access to the scripts - it's the Browser.

When using SSL the browser puts a minimum level of security on the connection and ensures that no unencrypted connections are being made from the page. This stops any unencrypted connections being used to transmit data in the requests.

The simplest option I can think of to work around this is to host the scripts yourself on the domain that is secured by SSL. It may or may not be possible to edit the widget easily so it uses the locally hosted script instead of the ones from the non-https site.