/    Sign up×
Community /Pin to ProfileBookmark

stop users exiting site?

Is there a script which i can add to my main index page to stop users exiting when they click the back button on their browser?

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@KorFeb 22.2008 — No. Nor it should exist such a thing. As a user I want to have full control upon my browser, ney? I would like to navigate wherever I want, back and forth upon my will. So that should be and, fortunately, so that is.
Copy linkTweet thisAlerts:
@baggiesmadauthorFeb 22.2008 — No. Nor it should exist such a thing. As a user I want to have full control upon my browser, ney? I would like to navigate wherever I want, back and forth upon my will. So that should be and, fortunately, so that is.[/QUOTE]

I totally agree.

A client of ours wants it on there site. It does exist as ive seen it in action!
Copy linkTweet thisAlerts:
@KorFeb 22.2008 — If it is, it should not be ? Yes, there is a possibility, not to suppress the back button, but to redirect the page again when simple back. I mean the entrance to a page (say ? can be done through another one (say A) which is instructed , when opened, to redirect always, within a second, to the page B. You don't need javascript to do that, a simple metatag refresh will do the job... But, once again, tell your client that he works against his own interests. Users will never come back again on his site second time after they saw such a scurvy trick. Nor it is very efficient, as the search engines will focus always the page B, not A, or even they might consider a phishing and exclude it from the view.

I am selling you the rope, now it's your business what to do with it ?
Copy linkTweet thisAlerts:
@ScriptageFeb 22.2008 — <body onBeforeUnload="location.reload()">

Works in older browsers, not IE7 etc.

Really p**ses people off.

Regards
Copy linkTweet thisAlerts:
@gomisuteFeb 22.2008 — Yes, you can do a number of things...which will annoy anyone...but also this can be disabled easily...and also your site (or your clients) will be avoided.

If you (they) wanna commit slow website suicide you can may be try this...which may or may not be supported by browsers out there:

<body onbeforeunload="alert('dont leave this site');">

or something as useless, cheezy and as annoying along those lines.
Copy linkTweet thisAlerts:
@baggiesmadauthorFeb 22.2008 — Thanks for your help guys/girls

I have just emailed the client hopefully talking them out of it.

I cant understand why they would want this sort of thing added??

pi**ing your visitors or possible future customers isnt a good thing.

Wouldnt this also mess around with the analytics?
Copy linkTweet thisAlerts:
@ZeroKilledFeb 22.2008 — i don't know what will comment other partner, but i believe it's okay to use such technique as far as is needed for security. for example, i had seen before a bank site that expire the user session if user press back button. it isn't done on javascript, it's done on server side. so, it don't prevent user to go back and forth, but if user do then the site alert user that the session expired and redirect user to the home page or login page. i know you aren't dealing on session, but at least for me that is acceptable. maybe your client may have a reason for preventing user going back, but it still annoying.
Copy linkTweet thisAlerts:
@KorFeb 22.2008 — i don't know what will comment other partner, but i believe it's okay to use such technique as far as is needed for security. for example, i had seen before a bank site that expire the user session if user press back button. it isn't done on javascript, it's done on server side. so, it don't prevent user to go back and forth, but if user do then the site alert user that the session expired and redirect user to the home page or login page. i know you aren't dealing on session, but at least for me that is acceptable. maybe your client may have a reason for preventing user going back, but it still annoying.[/QUOTE]
That is something different, you were talking about sessions which expires... [B]vannquish[/B] has not said a word about that. Besides, this is a server-side matter
Copy linkTweet thisAlerts:
@savvykmsFeb 23.2008 — Note the hostility against this.
[CODE]
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
var msg = "HAHA, NO LEAVING FOR YOU";
function stopuserfromleaving() {
document.title = msg;
window.status = msg;
document.location = document.location;
return false;
}
-->
</script>
</head>
<body onunload="stopuserfromleaving()">
<a href="http://www.google.com">googletest</a>
</body>
</html>
[/CODE]

It worked in my IE7 broswer. I tried in the latest firefox (at the time of this post), and did NOT work.
Copy linkTweet thisAlerts:
@felgallFeb 23.2008 — Of course it didn't work in Firefox - decent web browsers do not allow web pages to do such stupid things as that for security reasons. If you set the security in IE properly then it will not work there either.
Copy linkTweet thisAlerts:
@lAZLfFeb 23.2008 — No. Nor it should exist such a thing. As a user I want to have full control upon my browser, ney? I would like to navigate wherever I want, back and forth upon my will. So that should be and, fortunately, so that is.[/QUOTE]

i agree ,however, there is a script but it would make no sense in using it, it'll only drive away customer/clients/ect. away and also there's no reason for it because javascript [B]CAN[/B] be disabled.
Copy linkTweet thisAlerts:
@WebJoelFeb 23.2008 — Let me know what the site is, so I can 'permanetly block' it from ever resolving upon my computer (marked as DANGEROUS, -you know, THIS is why *some people [U]turn-off[/U] javascript* on their computer...)

I loathe, [I]LOATHE[/I] sites that remove MY freedom to navigate out of them. ?

And yes, I HAVE seen this script before... [I]in action[/I]. It exists.I[B] HATE[/B] it ([U]and[/U] the site(s) that use it!). :o
Copy linkTweet thisAlerts:
@felgallFeb 24.2008 — You don't have to turn off JavaScript to stop such nonsense because only JScript allows it in the first -place. Simply swap from using a browser that supports JScript to one that supports JavaScript and all the security issues (or at least most of them) will disappear.

In other words - just don't use Internet Explorer - use a real web browser instead.
×

Success!

Help @baggiesmad 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...