![](/img/trans.png)
[英]how to get the URL of a google script webapp inside the webapp
[英]Add query string to a Google Webapp URL
//htmlFileName: String
function createTemplate(htmlFileName) {
let {protocol,stdName} = getProtocolData()
let params = protocol // protocol: String, exemple 987654321
let url = 'https://script.google.com/a/macros/xxxxx.xxx.xx/s/beenchangedforsecurity/exec'
url += '?' + 'p' + '=' + params
/** **MY GOAL: url** *
* https://script.google.com/a/macros/xxxxx.xxx.xx/s/beenchangedforsecurity/exec?p=987654321
*/
let html = HtmlService.createTemplateFromFile(htmlFileName)
html.protocol = protocol
html.stdName = stdName
html.url = url
Logger.log(html.protocol)
Logger.log(html.stdName)
Logger.log(html.url)
return html.evaluate().getBlob().getDataAsString() }
錯誤:異常:格式錯誤的 HTML 內容:
https://script.google.com/a/macros/xxxxx.xxx.xx/s/beenchangedforsecurity/exec?p=000002036
我審查了我的 HTML 代碼並進行了以下更改:
原版的:
<p>
<form id="btn1" action= " https://script.google.com/macros/s/blablabla/exec/?p='1234567890' " >
<button typy="submit" id="uploadButton1"> Click here to send docs (param value with singlew quotes) </button>
</form>
<p>
新代碼:
<p>
<a id="clickhere" class="button" href= " <?!= url ?> " >
Clique aqui para enviar os documentos
</a>
</p>
我知道無法通過 GET 方法發送查詢字符串。 @Cooper,再次感謝您的提示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.