How to force a window reload in Service Portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 01:14 PM
location.reload(true);
window.location.href = window.location.href;
anyone else experienced the same or similar, and has anyone solved this?
- Labels:
-
Multiple Versions
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 01:50 PM
The great thing about having access to AngularJS in the Service Portal is that the majority of the time we can manipulate the $scope and therefore don't need to worry about refreshing. And while this does give our end users a better experience, I have come across times where it is necessary to reload the page. That being said, I would first try to accomplish what you're attempting to do via $scope manipulation. Here's a link to the documentation: https://docs.angularjs.org/guide/scope
And for some information as to why your original attempts did not work in IE/Edge: https://developer.mozilla.org/en-US/docs/Web/API/Location/reload (see browser compatibility section)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 01:52 PM
Looks like this is a known issue with IE. They suggest building in a timeout to solve it. See link below:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0717369
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2019 01:59 PM
Thanks both, will check and confirm back
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2022 09:51 PM
The reload() function takes an optional parameter that can be set to true to force a reload from the server rather than the cache. The parameter defaults to false, so by default the page may reload from the browser's cache. The true parameter forces the page to release it's cache.
The window.location.reload() will reload from the server and will load all your data, scripts, images, etc. again. So if you just want to refresh the HTML, the window.location = document.URL will return much quicker and with less traffic. But it will not reload the page if there is a hash (#) in the URL.