How to redirect to the page before last one in portal and agent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2023 02:00 AM
In my case, I am using an intermediate page for redirecting users to a specific page depending on a condition, but when the user tries to get back to the previous page, the system redirect the user to the intermediate page, and it is a sort of an endless loop.
And this intermediate page I am using it in Agent and portal as well.
So I want to know if there is a solution for this problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-19-2023 02:31 AM
In ServiceNow, you can use the "history.go(-2)" JavaScript function to redirect to the page before the last one. This function takes an integer argument, with a positive number representing the number of pages forward in the history, and a negative number representing the number of pages back in the history. To redirect to the page before the last one, you would use "-2" as the argument. For example:
history.go(-2);
You can also use the "history.back()" function to go back one page in the history.
Please mark the suggestion as helpful, if you find it useful to you or others who wants to refer similar content.
Please mark the solution as correct, if the answer provided by me has resolved your query.
Thank you!