我想从https://网站的http://源代码中访问一些代码。我有一个弹出窗口,提示用户更改其安全设置,但我不希望每次进入该站点的主页时都显示该弹出窗口。有没有办法检查他们的谷歌Chrome浏览器设置,以表明他们是否已经启用了不安全的元素显示?
目前我有:
function alertLoadData() {
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var secure = isSecure();
if (is_chrome && secure) {
alert('Please click on the shield to the right of the address bar to show the contents of the site. NOTE: the contents come from an insecure http:// address.');
}
}
isSecure()
检查它们是否位于网站的https://部分。我想要这样的内容:alreadyEnabledSecurity()
,用于检查用户是否已启用要显示的不安全内容,如果是,请执行以下操作:
function alertLoadData() {
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var secure = isSecure();
var settings = alreadyEnabledSecurity();
if (is_chrome && secure && !settings) {
alert('Please click on the shield to the right of the address bar to show the contents of the site. NOTE: the contents come from an insecure http:// address.');
}
}