[英]Can't have link in Embedded web app in Google site?
I'm trying to integrate a google script app deployed as a web app in a Google Site.我正在尝试将部署为 web 应用程序的 Google 脚本应用程序集成到 Google 站点中。 The embedding feature works well and all seems good at first.嵌入功能运行良好,一开始看起来一切都很好。 But for some reason links don't work in the embedded view.但由于某种原因,链接在嵌入视图中不起作用。 I can't find any specific topics about this.我找不到任何关于此的特定主题。
Google Script web app can be embedded everywhere I tried except in Google Site. Google Script web 应用程序可以嵌入到我尝试过的任何地方,除了 Google Site。 And Google Site can embed every site that allow it except web app from google script.谷歌站点可以嵌入所有允许它的站点,除了来自谷歌脚本的 web 应用程序。
EDIT (2)编辑 (2)
Turn out the problem can be resolved pretty quickly:原来问题可以很快解决:
Open https://sites.google.com and create a new site打开https://sites.google.com并创建一个新站点
Insert an "embed" choose the "embed code" option and copy paste this code:插入“嵌入”选择“嵌入代码”选项并复制粘贴此代码:
<:DOCTYPE html> <html> <body> <div> <a href="http.//google.com">Click Me!</a> </div> </body> </html>
Now testing on preview or once the site publish the link can't be clicked现在测试预览或一旦网站发布链接无法点击
You have to specified the target propriety.您必须指定目标属性。 Google script dont apply it by default so use this code: Google 脚本默认情况下不应用它,因此请使用以下代码:
<!DOCTYPE html>
<html>
<body>
<div>
<a target="_self" href="http://google.com">Click Me!</a>
</div>
</body>
</html>
FYI: I tried target="_self" and could not get it to work.仅供参考:我尝试了 target="_self" 但无法正常工作。 The below is currently working for me.以下内容目前正在为我工作。 In our use we have the text link and an image as an icon for the href.在我们的使用中,我们有文本链接和图像作为 href 的图标。 Please note the scriplet is the URL.请注意,脚本是 URL。 target="_blank" and with rel="noopener noreferrer" seems to have made the difference. target="_blank" 和 rel="noopener noreferrer" 似乎有所作为。 I didn't delve too far into why but this article seemed to proved better explanation than other documentation I reviewed: https://pointjupiter.com/what-noopener-noreferrer-nofollow-explained/我没有深入研究原因,但这篇文章似乎证明比我查看的其他文档更好的解释: https://pointjupiter.com/what-noopener-noreferrer-nofollow-explained/
<a target="_blank" href=<?=edGoogleDriveId?>><img src='google-drive.png' alt="Google Drive icon" rel="noopener noreferrer" class='icon';/>Employee folder</a>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.