【问题标题】:Adding href link in google sites through embedded code通过嵌入式代码在谷歌网站中添加 href 链接
【发布时间】:2023-02-02 05:18:27
【问题描述】:

我的 sites.google.com 中有三个名为(index.html、data.html、test.html)的页面。我使用页面部分的“整页嵌入”选项创建了这三个文件。我在 index.html 中添加 data.html 的超链接时遇到问题

我试过了

<a href="./data.html">Data</a>

<a href="data.html">Data</a>

在尝试上述方法时,一个链接自动添加为https://2004xxxxxx-atari-embeds.googleusercontent.com/embeds/16cb204cf3a9d4d2xxxxxxxxxxx/data.html,并在访问时出现 404 错误。

我还使用了直接链接<a href="https://sites.google.com/view/<path>/data-html">Data</a>,但许多浏览器阻止了它,说它是外部的

无论如何通过嵌入式代码本身将超链接添加到页面内部的页面

我可以使用 target="_blank" 在新选项卡中打开链接,但是有没有办法在同一个选项卡中显示(我使用了 target="_self" 但它阻塞了)

【问题讨论】:

  • 添加直接链接时,您是否有来自浏览器的阻止警报的屏幕截图?

标签: google-apps-script google-sites-2016


【解决方案1】:

听起来 Google 正在为这个整页嵌入功能使用完全不同上下文中的框架。既然如此,我认为您需要使用绝对 URL 从该位置链接到您网站上的其他页面:

<a target=_top href="https://example.com/data.html">Data</a>

target=_top 使链接适用于整个窗口,而不仅仅是框架。

【讨论】:

  • 无论如何要在当前选项卡中打开它?它适用于target="_blank",但不适用于target="_self"
  • 试试target=_top
  • 它不工作。我尝试多次点击它,但它没有执行任何操作。
  • 你能分享一个链接吗?
猜你喜欢
  • 1970-01-01
  • 2017-12-12
  • 1970-01-01
  • 2022-01-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多