通过参数锚链接到应用,谷歌应用脚本 [英] Anchor link to app with parameters, google apps script
问题描述
在我的html模板中有以下锚点:
I have the following anchors in my html template:
<a href="<?!= ScriptApp.getService().getUrl() ?>"><button>All Feedback</button></a>
<a href="<?!= ScriptApp.getService().getUrl()+"&filter=bomgar" ?>"><button>Bomgar Feedback</button></a>
<a href="<?!= ScriptApp.getService().getUrl()+"&filter=tickets" ?>"><button>Ticket Feedback</button></a>
使用参数浏览链接时,&和=符号是url中的%26和%3d。有没有办法来防止这种情况发生?
When navigating to the links with parameters, the "&" and "=" symbols are %26 and %3d in the url. Is there a way to prevent this from happening ?
谢谢
Thanks
推荐答案
要将GET参数添加到URL,您应该使用?
字符来介绍它们(而不是&
字符)。和号用于添加多个变量。所以你的URL应该是这样的。
To add GET parameters to a URL, you should use the ?
character to introduce them (instead of the &
character). The ampersand is used to add multiple variables. So your URL should look like this.
http://script.google.com/[.......]/exec?variable=data&otherVariable=otherData
因为你没有?
,这个网址被清理以消除这些字符。
So since you didn't have the ?
, the URL was sanitized to eliminate those characters.
这个网络应用程序,我已经说明了它们的不同之处。
This web app that I made illustrates the difference.
<a href="<?= ScriptApp.getService().getUrl()+"?filter=bomgar" ?>"><button>Bomgar Feedback</button></a>
这篇关于通过参数锚链接到应用,谷歌应用脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!