I am using the sample code provided by Serge insas found here: Google Apps Script to open a URL
I have modified the code slightly as seen below:
Code.GS<
As stated in the documentation regarding UI class:
A script can only interact with the UI for the current instance of an open editor, and only if the script is container-bound to the editor.
In the case of a Google Form, the editor is when you're editing a specific form and not when you're filling one. You can't automatically redirect a user after a form submission if the form is not embedded in a website, may be the workaround in this support article can help you.