Issue
- Need a solution to stop navigation when a user clicks on a navigation event.
- i.e.: A custom code wanted to be executed before the navigation.
Environment
- Liferay DXP 7.0+
Resolution
-
You can use the below sample code to access the event:
Liferay.on('beforeNavigate', function(event) { event.originalEvent.preventDefault(); });