Reputation: 15301
In my app, I require to user to not use the back button of the browser on the last page. For that I find a way to replacing existing url
with current page url
. so user will stay with same page.
I am using this JS code :
init(){//writing at init
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL);
});
},
But what is the correct code of ember to replace the above code? what is the correct way to do?
thanks in advance.
Upvotes: 0
Views: 56
Reputation: 1911
You can prevent the user from transitioning to another route within your application by aborting any transition made from the willTransition hook of your last page's route. Add something like
actions: {
willTransition(transition) {
transition.abort();
}
}
to your last page's route
Upvotes: 1