I have a webapp that has multiple pages served as templates in a sandbox. I want to pass an ID as a url parameter between pages in my webapp.
Issue 1: I don't know how from my javascript page file I can access the url parameters as when using window.location I do not get the same url that shows in the address bar.
Is there a way of getting the parameter directly from javascript or do I have to get the server to send it to javascript?
If I need to get it from the server I am worried that as the webapp is meant to have multiple users who are on different pages of the webapp how will the server know which url to send?
Sorry if what I am saying does not make sense! I include some code below to try and help explain the issue...
Code.gs code:
function doGet(e){
var param1 = e.parameters.v;
var param2 = e.parameters.id;
if(param1 == "form"){
return loadForm();
} else if(e.parameters.v == "class") {
return loadClassView();
} else {
var tmp = HtmlService.createTemplateFromFile("home");
tmp.baseUrlToSend = baseURL;
return tmp.evaluate();
}
}
javascript:
function OnLoad(){
var thisURL = window.location;
alert(thisURL);
//I hoped this would alert something along the lines of "https://script.google.com/a/macros/s/-MY-WEB-APP-ID-/dev?v=class&id=0d2f35e9-d785-4fab-a8ee-fe8933f1c159"
//But what this actually alerts is "https://n-g5aftzut - REMOVED FOR SECURITY -mmajfkwvesq-0lu-script.googleusercontent.com/userCodeAppPanel"
}