Redirection to a page outside of SharePoint after saving a form
Today, I would like to demonstrate how to set up a redirection if a page outside of the current SharePoint domain.
The crux of the problem
A redirection to a page withing the current domain can be set up easily in Forms Designer → General Settings. Just specify a server-relative URL in the ‘Redirect after submission URL’ field.
But what if you want to redirect to a page outside of your SharePoint domain. SharePoint does not allow you to do that but you can bypass the limit by following the steps below.
Solution
First, you should create a redirection page withing your SharePoint domain. Then, insert a script that redirects users to an arbitrary page.
- Go to Site Contents and switch to Classic View, if you have Modern View now
- Go to Site Pages and add a new page, name it “Redirection”, for example
- Go to Insert → Web Part → Media and Content → Script Editor, click “Add”
- Open a context menu of Script Editor, click “Edit Web Part”
- Click “Edit snippet”
- Add this code:
<script> window.location.href = "Your URL" </script>
- Save the web part.
Finally, add this code to your form:
fd.onsubmit(function() { fd.sourceFormParam("URL of your redirection page"); return true; });
Or just insert a link to your redirection page to General → ‘Redirect after submission URL’ field
Hope the solution will be helpful. Don’t hesitate to ask your questions.