1

I created a form which uploads form field data to a Google Sheet and uploads a file to Google Drive. Right now, upon submission, the page is redirected to a new page that says "File uploaded successfully to the google drive url."

I want to redirect to a specific URL. How do I do this?

!!UPDATE 7/20!! I have updated the code as recommended by Jonas W below. However, after checking the debugger, the following error is issued:

"Load denied by X-Frame-Options: https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https%3A%2F%2Fn-a5ewhrjyamnkpqisqxvdofomdabpix44dfr7wvq-0lu-script.googleusercontent.com%2Fcenterforalternativefuels.org&followup=https%3A%2F%2Fn-a5ewhrjyamnkpqisqxvdofomdabpix44dfr7wvq-0lu-script.googleusercontent.com%2Fcenterforalternativefuels.org does not permit framing."

Any recommendations as to how to work around X-Frame-Options?

Here is the current redirect code at the end of my file upload function:

return "File uploaded successfully" + file.getUrl();

The file upload function is called in the form html file:

<input type="submit" value="Submit" 
   onclick="this.value='Uploading..';
            google.script.run.withSuccessHandler(fileUploaded)
            .uploadFiles(this.parentNode);
            return false;" style="margin-top: 20px">

And here is the fileUploaded code from the form html file:

<script>
 function fileUploaded(status){ 
  window.location="http://centerforalternativefuels.org";
 }
</script>
  • The [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) is a Http response header that can be used to indicate whether or not a browser should be allowed to render a page in a ``, ` – KENdi Jul 21 '16 at 15:33

1 Answers1

0
<script>
function fileUploaded(status){ 
window.location="http://newurl";
}
</script>
Jonas Wilms
  • 132,000
  • 20
  • 149
  • 151
  • where do i call this function? – thisFunkinGuy Jul 21 '16 at 00:32
  • You have to replace newurl with the url you want to. I think this is understandable – Jonas Wilms Jul 21 '16 at 00:56
  • Yes, I knew that. I tried to redirect to my desired URL and it didn't work. – thisFunkinGuy Jul 21 '16 at 01:19
  • There are no errors when the form is submitted. The data is uploaded to a google sheet and the file is uploaded to google drive. How else can I check for errors or things that could be debugged? – thisFunkinGuy Jul 21 '16 at 01:57
  • Using firefox do right click and then debug. The developer window will open and you can check if anything was logged. – Jonas Wilms Jul 21 '16 at 02:00
  • Load denied by X-Frame-Options: https://accounts.google.com/ServiceLogin?service=wise&passive=1209600&continue=https%3A%2F%2Fn-a5ewhrjyamnkpqisqxvdofomdabpix44dfr7wvq-0lu-script.googleusercontent.com%2Fcenterforalternativefuels.org&followup=https%3A%2F%2Fn-a5ewhrjyamnkpqisqxvdofomdabpix44dfr7wvq-0lu-script.googleusercontent.com%2Fcenterforalternativefuels.org does not permit framing. – thisFunkinGuy Jul 21 '16 at 02:25