title: "How can I get the url query string parameters of a google apps script web app sandbox in javascript?
body: <p>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.</p>
  <p>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.</p>
  <p>Is there a way of getting the parameter directly from javascript or do I have to get the server to send it to javascript?</p>
  <p>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?</p>
  <p>Sorry if what I am saying does not make sense! I include some code below to try and help explain the issue...</p>
  <p>Code.gs code:</p>
  <pre><code>function doGet(e){
   
   var param1 = e.parameters.v;
    
    var param2 = e.parameters.id;
    if(param1 == &quot;form&quot;){
    
      return loadForm(); 
    
    } else if(e.parameters.v == &quot;class&quot;) {
      return loadClassView();
    } else {
      var tmp = HtmlService.createTemplateFromFile(&quot;home&quot;);
      tmp.baseUrlToSend = baseURL;
      
      return tmp.evaluate();
    }
  }
  </code></pre>
  <p>javascript:</p>
  <pre><code>function OnLoad(){
  
     var thisURL = window.location;
     alert(thisURL);
     //I hoped this would alert something along the lines of &quot;https://script.google.com/a/macros/s/-MY-WEB-APP-ID-/dev?v=class&amp;id=0d2f35e9-d785-4fab-a8ee-fe8933f1c159&quot; 
     //But what this actually alerts is &quot;https://n-g5aftzut - REMOVED FOR SECURITY -mmajfkwvesq-0lu-script.googleusercontent.com/userCodeAppPanel&quot;
      
  }
  </code></pre>