Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  155] [ 1]  / answers: 1 / hits: 33434  / 11 Years ago, tue, december 31, 2013, 12:00:00
<label>
<input type=button onclick=abc() id=log value='SUBMIT'>
</label>
<script>
function abc() {
google.script.run.withSuccessHandler(callback).processForm(document.forms[0]);
}

function callback(ste) {
if (ste == true) {
var a = document.getElementById('log');
document.write(a.value);
document.write('<a href=http://www.w3schools.com/js/js_htmldom_html.asp>do stuff</a>');
} else document.write(false);
}
</script>


as i m using document.location && window.location both are not working to switch page,is there any other method which can help me out to


More From » html

 Answers
5

You've left clues, including the tag and the call to google.script.run, but your question should make it clearer that this code is being hosted from the Google Apps Script environment. That limits the solution, as described in the documentation for Class HtmlOutput.



You are trying to redirect the browser to a new URL, which is not allowed in Apps Script web apps.ref



That means that none of the other provided javascript solutions will work. Your work-around of presenting the user with a clickable link is your only option for redirecting to an external URL. (external == not your web app)



You can provide the illusion of a redirect to another html page within your Apps Script WebApp, though. See this answer for an example of serving multiple html pages using HtmlService. The basic idea is to write doGet() to accept a query parameter that it will use to select which html page to serve.


[#73469] Sunday, December 29, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kaylinshayd

Total Points: 443
Total Questions: 104
Total Answers: 111

Location: Nauru
Member since Wed, Mar 29, 2023
1 Year ago
;