【问题标题】:Open an Iframe in a modal popup in Google sheets在 Google 表格的模式弹出窗口中打开 Iframe
【发布时间】:2020-06-09 19:12:38
【问题描述】:

我想在 Google 表格中打开一个模式弹出窗口

我在code.gs中有:

function onOpen() {
SpreadsheetApp.getUi()
  .createMenu('Custom Menu')
  .addItem('Open Dialog Box', 'openDialog')
  .addToUi();
}

function openDialog() {
  var html = HtmlService.createHtmlOutputFromFile('index');

  SpreadsheetApp.getUi()
    .showModalDialog(html, 'Correct Postcode Errors');
}

在 index.html 中

<!DOCTYPE HTML>
<HTML>
<body>

<iframe src="https://www.w3schools.com" title="W3Schools Free Online Web Tutorials"></iframe>

</body>
</html>

我得到了弹出窗口,但 iframe 没有连接

如何让 iframe 连接?

这是带有上述代码的 Google 表格 https://docs.google.com/spreadsheets/d/1LHiTZB225jFnOdzflUkm0ZSO6Wy_XQ_0OJ9WwAk46dA/edit?usp=sharing

谢谢

【问题讨论】:

  • 也许 w3schools.com 会阻止您这样做。和他们谈谈。
  • 您的评论是否暗示它应该可以工作,但不是由于那个特定的 URL?因为我也试过https://www.google.com/,但也没有用
  • 阅读我的答案。
  • 它告诉他们什么是他们拒绝连接,因为他们不希望你 iframe 他们的网站。我也不会。
  • @xyz333 站点可以阻止它们显示在 iframe 中。谷歌和 w3schools 都有理由防止/保护他们的网站不被 iframe。可能有替代方案。谷歌表单不会让你直接 iframe 它,但它提供了一个特定的 iframe url 供你框架它

标签: google-apps-script iframe google-sheets modal-dialog


【解决方案1】:

www.w3schools.com 拒绝连接。

这表明他们拒绝连接,因为他们不希望您为他们的网站添加 iframe。

【讨论】:

    猜你喜欢
    • 2015-02-01
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多