title: Redirect after processing a POST request in Apps Script
body: <p>I have had an issue with getting the google scripts page to redirect back towards my custom URL.  The script currently executes but I cant get it to redirect back to its previous page  after it is finished executing. </p>
  
  <p>Heres the script.gs code:</p>
  
  <pre><code>function doPost(e) {
  
    try {
      Logger.log(e); // the Google Script version of console.log see: Class Logger
      record_data(e);
  
      // shorter name for form data
      var mailData = e.parameters;
      var name= String(mailData.name);
      var message= String(mailData.message);
      var email= String(mailData.email);
      var all= ("Name: "+name+"\nReply address: "+email+"\nMessage: "+message);
  
  
      // determine recepient of the email
      // if you have your email uncommented above, it uses that `TO_ADDRESS`
      // otherwise, it defaults to the email provided by the form's data attribute
      var sendEmailTo = (typeof TO_ADDRESS !== "undefined") ? TO_ADDRESS :     mailData.formGoogleSendEmail;
  
      MailApp.sendEmail({
          to: String(sendEmailTo),
          subject: String(mailData.subject),
          replyTo: String(mailData.email), // This is optional and reliant on your form actually collecting a field named `email`
          body: String(all)
      });    
      doGet();
      return HtmlService.createHtmlOutput('xxxxxxxxxx.com');
    } catch(error) { // if error return this
      Logger.log(error);
      return ContentService
          .createTextOutput(JSON.stringify({"result":"error", "error": error}))
          .setMimeType(ContentService.MimeType.JSON);
    }
  }  
  
  function doGet() {
    return HtmlService.createHtmlOutputFromFile('Index');
  }
  </code></pre>
  
  <p>Here is my HTML code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta http-equiv="refresh" content="2;url=xxxxxxxxxx.com" /&gt;
      &lt;base target="_top"&gt;
    &lt;/head&gt;
    &lt;body&gt;
      Click &lt;a href="xxxxxxxxxx.com"&gt;here&lt;/a&gt; to go back.
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>What would be the best way to make the script open the index.html page so I could easily redirect back to the custom URL? </p>