
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 06:52 AM
Management is requesting an alert to the user when they are clicking on a content item that a user can click on to warn them they are leaving the service portal. This is to prevent confusion on where this item may be tracked. This item is a submission form for another system.
This is similar in the way that .GOV sites will warn you are leaving the site when clicking on a link to a commercial site. I've attached an example.
Any thoughts on the best way to do this?
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 12:58 PM
If I understand you correctly, then you can solve the problem by adding event handler on $locationChangeStart on $rootScope. You can place the code in header widget or inside of scripted menu item or in any other part, which will be loaded on every page. The code of the event handler could look like the following:
$rootScope.$on("$locationChangeStart", function(event, next) {
event.preventDefault();
// ... do some tests
$window.location = next;
});
You should execute $window.location.href = next; statement only if you want to allow redirection.
You can find more information about $locationChangeStart event, spSCNavStateManager or spNavStateManager directives and some code examples in my old answer on the question.
To display alert message you can use spModal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2019 12:58 PM
If I understand you correctly, then you can solve the problem by adding event handler on $locationChangeStart on $rootScope. You can place the code in header widget or inside of scripted menu item or in any other part, which will be loaded on every page. The code of the event handler could look like the following:
$rootScope.$on("$locationChangeStart", function(event, next) {
event.preventDefault();
// ... do some tests
$window.location = next;
});
You should execute $window.location.href = next; statement only if you want to allow redirection.
You can find more information about $locationChangeStart event, spSCNavStateManager or spNavStateManager directives and some code examples in my old answer on the question.
To display alert message you can use spModal.