【问题标题】:Issue when using Polymer through HtmlService in Firefox在 Firefox 中通过 HtmlService 使用 Polymer 时出现问题
【发布时间】:2017-08-23 01:05:05
【问题描述】:

我刚刚注意到以前在 Firefox 中运行的代码现在抛出错误

这是重现问题的简单 Google Apps 脚本示例代码(嵌入在 Google 电子表格中):

服务器端:

function uiTest(){
  var html = HtmlService.createTemplateFromFile('ui-test');
  var ui = html.evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
  SpreadsheetApp.getUi().showModelessDialog(ui," ");
}

在哪里 ui-test html:

<head>
  <base href="//polygit.org/components/">
  <link rel="import" href="polymer/polymer.html">
  <script src="webcomponentsjs/webcomponents.js" type="text/javascript"></script>
  <link rel="import" href="paper-material/paper-material.html">

  <dom-module id="ui-firefox">
    <template>
      <paper-material>Can you see me in Firefox?</paper-material>
    </template>
    <script>
      HTMLImports.whenReady(function() {
        Polymer({
          is: "ui-firefox",
          ready: function() {
            console.log("Am I ready?");
          }
        });
      });
    </script>
  </dom-module>
</head>

<body>
  <ui-firefox> </ui-firefox>
</body>

报错如下...

来自“https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https://n-47juae2agfc3xqpt4fvdar7apw5jvvjx5nohrjy-0lu-script.googleusercontent.com/webcomponentsjs/webcomponents.js&followup=https://n-47juae2agfc3xqpt4fvdar7apw5jvvjx5nohrjy-0lu-script.googleusercontent.com/webcomponentsjs/webcomponents.js”的资源由于 MIME 类型不匹配(X-Content-Type-Options: nosniff)而被阻止。

关于如何解决/避免此问题的任何想法?

【问题讨论】:

  • 在电子表格中使用时是否有 set-origin:allowall 的原因?
  • @SpencerEaston 没有理由,我只是在尝试并让它放在那里,如果删除也不会改变 - 谢谢

标签: firefox google-apps-script polymer


【解决方案1】:

在 2018 年 1 月 23 日发布的 Firefox 58 版本中,这个问题已经消失,不再发生。 希望它会保持这种状态......

【讨论】:

    猜你喜欢
    • 2011-08-22
    • 2019-12-27
    • 2014-12-18
    • 1970-01-01
    • 1970-01-01
    • 2017-12-05
    • 2016-09-06
    • 1970-01-01
    • 2020-06-06
    相关资源
    最近更新 更多