chrome browser back arrow redirection issue in Single page application

Amit Dey
Tera Contributor
Currently on our homepage, on click of  browser Back arrow, it loads the URL of the previous page, however, on click, it actually does not redirect the user to previous page. 
 
Requirement is to redirect user to the previous page. 
3 REPLIES 3

Valmik Patil1
Kilo Sage

Hello @Amit Dey ,

Is this on the portal? can you provide more details.

Thanks,

Valmik Patil

kaushal_snow
Mega Sage

Hi @Amit Dey ,

 

Use sysparm_nostack=true to Prevent Navigation Stack Entries in Classic UI. If your SPA includes UI pages embedded via UI macros (e.g., within iframes or similar), ServiceNow navigation stack can disrupt back navigation....

 

Workaround would be, append the URL parameter sysparm_nostack=true to the UI page URL. This prevents the page from being added to the navigation stack, avoiding strange back-button behavior.

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

We’ve developed our application entirely using widgets. On page load, the application checks the hash in the URL and loads the corresponding widget based on it. Similarly, when a user clicks on a link, the hash in the URL is updated, and the relevant widget is loaded accordingly.

All the logic that determines which widget to load based on the hash is handled in a separate widget.

The issue we’re facing is that when the user navigates using the browser's back or forward buttons, the URL hash updates as expected, but the corresponding widget does not get loaded. However, if we manually refresh the page, the correct widget loads based on the updated hash.

What would be the proper way to ensure that the widget updates correctly when the hash changes due to browser navigation?