Firefox 上 HTTPS iFrame 的安全错误

SecurityError with HTTPS iFrame on Firefox

对于我正在进行的实习项目,一个 java 网络应用程序,我需要向 不完全 HTTPS 网站发送通知。 OneSignal 提供了这样做的可能性。

起初,为了测试他们的服务,我在 jsp 文件的一些 <script> 标签内直接硬编码了客户端 SDK java 脚本,它工作正常。

<script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js" async='async'></script>
<script>
  var OneSignal = window.OneSignal || [];
  OneSignal.push(["init", {
    appId: "my-app-id",
    autoRegister: false, 
    notifyButton: {
        enable: true
    }
  }]);
</script>

但是,我不得不将我的 java 脚本移动到一个 js 文件中,因为我公司的开发规则指定 java 脚本不应在 jsp 文件中。所以我 link 将代码编辑到一个按钮以使用 document.querySelector('.id-foo').addEventListener('click', initOneSignal).

手动激活它

然后 java 脚本文件被动态加载到我的 jsp.

的页脚

这是我的 js 文件:

(function() {
    document.querySelector('.js-initOneSignal').addEventListener('click', initOneSignal);

    function initOneSignal() {  
        var OneSignal = window.OneSignal || [];
        OneSignal.push(["init", {
            appId: "my-app-id",
            autoRegister: false, 
            notifyButton: {
                enable: true
            }
        }]);
    };
})();

但是,它不再工作了(仅在 Firefox 上,在 Chrome 上没问题),因为我从 OneSignalSDK.js 收到这条试图打开的消息一个 iFrame 到 https://my-app-name.onesignal.com/webPushIframe 但无法和超时。

SecurityError : The operation is insecure

显然这是一个错误 https://github.com/OneSignal/OneSignal-Website-SDK/issues/95. The issue is marked as closed while I think it should be open again, newer version of Firefox might have changed something. Here is the link to the my github issue : https://github.com/OneSignal/OneSignal-Website-SDK/issues/359

是否有人遇到了该问题并找到了解决方法?

在此先感谢您的帮助!

PS : 我使用的是 Firefox 60

PPS:iFrame OneSignal 尝试打开:

<!DOCTYPE html>
<html>
    <head>
        <script src="https://cdn.onesignal.com/sdks/OneSignalSDK.js"></script>
        <script>OneSignal._initHttp({
            appId: "myappid",
            subdomainName: "mysubdomainname",
            origin: "http://my-website"
        });</script>
        <link rel="manifest" href="manifest_json">
     </head>
     <body>
     </body>
</html>

编辑:

OneSignal 仍然没有响应。他们的 "Support" link 不工作。

我找到了解决办法!这很明显。我只需要 重置 Firefox,它现在工作正常。感谢这个 page 给了我提示。

这个问题与我在 HTTP 和 HTTPS 配置之间切换以测试不同的 webpsuh solutions/service 有关。为此,我必须使用自定义 SSL 证书来伪造完全 HTTPS 网站并在 Firefox 中添加安全预期。当回到 HTTP 时,我的 Firefox 配置仍然以某种方式受到此异常的影响,因此 Firefox 抛出安全错误。