我正在使用 Chrome 扩展程序使用以下代码在 https 网站上显示来自 http 网站的内容:
$("#div").html('<object data="http://example.com/"');
但是,由于混合使用 http 和 https,我收到此错误:
Mixed Content: The page at 'https://website.com' was loaded over HTTPS, but requested an insecure plugin resource 'http://example.com/'. This request has been blocked; the content must be served over HTTPS.
我该如何克服这个问题? http网站无法用https加载。
注意:我必须使用 Javascript/jQuery,因为我正在使用 Chrome 扩展中的代码。
最佳答案
您可以通过编写一个可以通过 HTTPS 从外部访问并通过 HTTP 在幕后检索请求的 URL 的代理脚本(可以驻留在任何地方)来解决这个问题。
您的扩展会请求:
$("#div").html('<object data="https://your-proxy-server.com/your-script">');
关于jquery - 使用 jQuery 将内容从 HTTP 页面加载到 HTTPS 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41085719/