how to disable the browser back button in javascript.

140 views
Skip to first unread message

usha rani

unread,
Apr 23, 2015, 9:17:44 AM4/23/15
to rubyonra...@googlegroups.com
how to disable the browser back button in javascript.

Norbert Melzer

unread,
Apr 23, 2015, 9:21:05 AM4/23/15
to Rails Mailinglist

Dont!

Am 23.04.2015 15:17 schrieb "usha rani" <usharan...@gmail.com>:
how to disable the browser back button in javascript.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5dc414ca-4c0e-4b87-855a-46e676d86333%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Si Tanguy

unread,
Apr 23, 2015, 10:57:09 AM4/23/15
to rubyonra...@googlegroups.com
You can't, and you shouldn't.

every other approach / alternative will only cause really bad user
engagement.

Put This script on head of your page and change 'pagename' to your page
name.
but anyway , here is a trick :

<script type = "text/javascript" >
history.pushState(null, null, 'pagename');
window.addEventListener('popstate', function(event) {
history.pushState(null, null, 'pagename');
});
</script>

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages