I followed the answer in this thread Linking to another HTML page in Google Apps Script however I can only view the first page when the button is clicked and anything after that just comes up with a blank page. I have tried setting the sandbox mode to IFRAME and NATIVE detailed here Linking to another html page in google apps script does not seem to work with no luck.
Thanks for the responses, I have included my amended code below. Following this https://developers.google.com/apps-script/migration/iframe I added target="_top" to the header sections to overdide each links target attribute. I have also included the DOCTYPE html tags.
The first "index" page will now load, however clicking on a link from this page brings up an error No HTML file named project was found. (line 11, file "Code", project "Teams"). The URL plus query string looks like this
https://script.google.com/macros/s/<SCRIPTURL>/exec?page=project
Code.gs
function getScriptUrl() {
var url = ScriptApp.getService().getUrl();
return url;
}
function doGet(e) {
if (!e.parameter.page) {
return HtmlService.createTemplateFromFile('index').evaluate();
}
return HtmlService.createTemplateFromFile(e.parameter['page']).evaluate();
}
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Source = index.html</h1>
<?var url = getScriptUrl();?><a href='<?=url?>?page=project'> <input type='button' name='button' value='project.html'></a>
</body>
</html>
project.html
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
<h1>Source = project.html</h1>
<?var url = getScriptUrl();?><a href='<?=url?>?page=index' target="_top"> <input type='button' name='button' value='index.html'></a>
</body>
</html>
console.log()
andLogger.log()
and the troubleshooting guide, you will need to use both of those to find problems in your code. Link to Apps Script troubleshooting guide From the information you have given, we would need to copy all the code from that answer, add it to our own project, run it, debug it, and guess at what the problem might be. Even though you have referenced code you are using, the smallest detail could be a problem. – Alan Wells