Forum Moderators: open

Message Too Old, No Replies

Disable the back button of browser

back button to be disabled

         

ravi

5:37 am on Jul 22, 2008 (gmt 0)

10+ Year Member



Hi,

When the person type the url of the website

Ex:

http://www.example.com/index.php

the back button of the browser to be disabled.

I tried two method

i)Window.open

I used the window.open to call some other page other than index page.

BUT I COULDN'T close the parent window in Firefox.

ii)history.forward()

It is also working well with the IE only

Can Anyone help me to fix this issue

by
ravi

[edited by: DrDoc at 4:52 pm (utc) on July 22, 2008]

Fotiman

12:58 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Don't do that. It will annoy your users, probably driving them away from visiting your site again.

ravi

1:57 pm on Jul 22, 2008 (gmt 0)

10+ Year Member



Thanks Fotiman,

Sorry Fotiman our client want to do this.

Can pls help me to do like that

StoutFiles

2:12 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can do it with frames, Google it.

But really, disabling the back button will make people never come back again.

...well they'll come back after hitting the back button...but after that, never again!

[edited by: StoutFiles at 2:13 pm (utc) on July 22, 2008]

Fotiman

2:21 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ravi, its your job to convince your client that this is a very, very, very bad idea. They may be the client, but you are supposed to be the expert they rely on. I could go to the doctor and tell them I want my left arm removed because it gets in the way, but any reputable doctor will not go along with it just because *I* want them to.

(Note, I do not want my left are removed). :)

DrDoc

4:52 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



First of all:

It cannot be done. Period. You may be able to achieve what might appear to be a foolproof solution, but it will not be 100% reliable (not even 50%). Give me a browser and two minutes, and I'll be using the back button again.

Secondly:

As has already been said -- disabling the back button is a ridiculously bad idea. Your client doesn't know what they're talking about, and you need to tell them that. Refuse the job, if nothing else. Whatever reason they might have for wanting to disable the back button, there are multiple reasons against for each perceived reason for.

The problem is not the back button. The problem is something else, and that's what you need to identify. Do they want to ensure completion of a form? Do they want to retain status or information over several pages? Whatever it is they seek to accomplish, disabling the back button is not the solution. They just think it is, because they do not have the technical knowledge to identify the real solution to the real problem.

Martin72

7:55 pm on Jul 22, 2008 (gmt 0)

10+ Year Member



OK, it's a bad solution.
But here's how it works. Just insert within the head section :
<script type="text/javascript">
function noBack(){window.history.forward()}
noBack();
window.onload=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack()}
window.onunload=function(){void(0)}
</script>
Do not use except https or intranet.

g1smd

9:00 pm on Jul 22, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** our client want to do this ***

Time for you to show them how bad an idea that really is.

ravi

4:44 am on Jul 23, 2008 (gmt 0)

10+ Year Member



Thanks alot,

I will try to convince my client.I tried lots of method but the browser compatibility is very less.

Thanks
ravi

ravi

9:41 am on Jul 23, 2008 (gmt 0)

10+ Year Member



Hai,

I am trying method may be bad.When i try to use the

window.open("index.html","sample","toolbars=no");

it is disabling the toolbar option.

When i tried using the following method

window.open("index.html","_parent","toolbars=no");

it is not disable the toolbar option.

was there any way to hide the toolbar on the parent window.

By doing that i will be able to hide the back button.

I knew it is a bad idea.

can anyone help me.

by
ravi

Marcia

10:21 am on Jul 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The only kind of a site owner who would insist on something like this is one who has the kind of site people would want to ESCAPE from, and it cannot in any way be a legitimate site.

ravi, with all due respect, if anyone helps you find a way to do this, then they should be horsewhipped.

Fotiman

1:29 pm on Jul 23, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ravi, you just keep loading bad practice on top of bad practice. Hiding the toolbar is, once again, very bad for usability.

Have you asked the client specifically what it is that they are trying to achieve? That is, *why* do they want to disable the back button?

Marcia

5:05 am on Jul 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My guess is that they'll be spewing non-stop nasty pop-ups and want to keep visitors from escaping so they can get paid for each piece of garbage they inflict people with. Sites like that don't care whether or not people want to see their nasties, they just want money - even if they have to hijack people's computers to their sites with malware.

Which is another thing - maybe they want to keep people trapped long enough to give them a gift of forced malware downloads.

One word for it: EVIL

[edited by: Marcia at 5:06 am (utc) on July 30, 2008]

DrDoc

5:33 pm on Jul 30, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In fact, hijacking a browser session like Marcia describes is illegal in many places.

slick

9:05 pm on Jul 30, 2008 (gmt 0)

10+ Year Member



I've been to websites where the back button is non-functional. It might be visible and clickable but it will not do anything. And these websites I talk about are definitely not malware/spyware websites. I'm not sure of the reason they implement this functionality for.. it's really annoying.. but hmm.. if you can convince your client, all well & good, but if it costs you your job....wow... really an ass of a client.. and then you're in situation where you wanna balance, is the bread & butter more important... or bad practices, etc... lol.. this is turning out to be an ethical issue on top of a technical one. Pretty funny...