0

我想从 https:// 网站的 http:// 源访问一些代码。我有一个弹出窗口提示用户更改他们的安全设置,但我不希望每次访问网站主页时都显示弹出窗口。有什么方法可以检查他们的 Google 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.');
    }
}

WhereisSecure()检查它们是否在网站的 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.');
    }
}
4

0 回答 0