/    Sign up×
Community /Pin to ProfileBookmark

how to disable back button

hi,

I need to know how to disable the back button on a browser. I am not sure if this is a javascript thing or what. I have seen it dont on certain web sites on the net.
I need it so that if a user presses the back button they remain on the same page,
how can this be done?
thanks a lot

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Dec 09.2004 — It is not possible. What you could is to cause IE to place it in history twice, tricking the browser when it goes back to recreate the history, so it takes going back twice quickly, or using the down arrow.

Nonetheless, it won't work in other browsers, since IE handles history much differently [and more favorably, imo] than other browsers do. There are pros and cons to it.

Nonetheless, it shouldn't be done. What you arte really trying to do is trap your user into staying at your page ... that's not a great idea.

Dr. Script
Copy linkTweet thisAlerts:
@Willy_DuittDec 09.2004 — <body onload="history.go(-1)">
×

Success!

Help @damon2003 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...