Skip to content Skip to sidebar Skip to footer

Web App HTML, JS + Google Apps Script: How To Go Back To My App After Return In GAS?

I'm building a web app using HTML, CSS and JavaScript and using Google Spreadsheet as a database. I'm planning to use PhoneGap to turn my web app into a real app. I was able to rea

Solution 1:

This is the solution to your problem.

Instead of using return ContentService.createTextOutput(someOutput);

use HtmlService to return to your form

return HtmlService.createHtmlOutputFromFile('redirect').setSandboxMode(HtmlService.SandboxMode.IFRAME);

And your HTML file should look like this,

Update: redirect.html should be in the same project as that of your app script file.

redirect.html

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<title>This Is A Sample Title</title>
<script>
function test()
{
    window.location.href = "www.hostname.com";
}
</script>
</head>
<body onload="test()">
Login
</body>
</html>

See if this works for you.


Post a Comment for "Web App HTML, JS + Google Apps Script: How To Go Back To My App After Return In GAS?"