Reputation: 1778
I have 2 html in my google script and trying to create a link from one.html to two.html . When i load one.html, i can see the link of two.html. I can right-click and choose "open link in new tab" and it will works just fine. But if i click the link directly, google script refuses it. I got broken link error : script.google.com refused to connect.
I can copy/paste the url so the generated url is definetely correct but i can't link by clicking the <a href="">.
Does anyone know how to fix it ?
Code.gs
function getScriptUrl() {
var url = ScriptApp.getService().getUrl();
return url;
}
function doGet(e) {
Logger.log( Utilities.jsonStringify(e) );
if (!e.parameter.page) {
return HtmlService.createTemplateFromFile('one').evaluate();
}
return HtmlService.createTemplateFromFile(e.parameter['page']).evaluate();
}
one.html
<html>
<body>
<h1>ONE</h1>
<?var url = getScriptUrl();?><a href='<?=url?>?page=two'> two.html</a>
<p><?=url?>?page=two</p>
</body>
</html>
two.html (just an empty page)
<html>
<body>
<h1>TWO</h1>
</body>
</html>
Upvotes: 0
Views: 781
Reputation: 5862
Add target="_top"
to the a tag
I think it relates to iframe problem of web apps
Upvotes: 2