To prevent user to go back, I used the below code :
<script type = "text/javascript" >
history.pushState(null, null, 'pagename');
window.addEventListener('popstate', function(event) {
history.pushState(null, null, 'pagename');
});
</script>
I found it from the below link:
How to disable back button in browser using javascript
However, this works fine in Chrome but not working in firefox and IE. In inspect element i can see the script in Chrome but its not there in firefox and IE.