Forum Moderators: open
Disabling the back button is tremendously bad internet practice. I did it by accident once and got several VERY nasty emails.
Unless you put everything in an image, or write the entire page in Flash, the browser NEEDS the source to render the HTML page. Once the client machine has the HTML, it's available.
What is so precious that you have to hide it? If you have passwords, etc. in there, then you need to re-write the page.
There is NO way to do this.
There are also two other ways:
Write your own browser... and your own Web server... and have it serve the pages only to your own browser over the 65535-bit encrypted protocol you just wrote...
Or, allow people to use whatever browser they want... But don't send a page back to them. Instead you can fax them the contents...
Better to write the application from the ground up assuming that users can and will view the source and use the back arrow.
There is ABSOLUTELY no way to stop someone from viewing your HTML, images, javascript, etc.
If there are password, you need a server sides solution like PHP, ASP, Perl, Python, etc...
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers¦¦document.getElementById&&!document.all){
if (e.which==2¦¦e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
Note:
I got the above from a site where the right click was disabled ;)
All disabling the right click does is annoy users. Most, if not all, the things on the right-click (the shortcut menu) can be done another way.
One thing: personal URLs are not allowed in the forums per the TOS. You might want to edit it yourself before an administrator does.
Yes, your home page is a "mess" to view the source. Nice looking otherwise. As you say, to a casual observer it's unreadable, but a quick download of the tool you mentioned opened it right up. Still, it's better than nothing, and I think I *will* look into it for a project I'm developing that needs to deliver ASP pages in an off-line environment. I don't care about the HTML so much as the business logic in the database calls.
Thanks for the link.
a mouse without a right button? thats unusual...would make playing computer games interesting...
Not unusual at all... All Macs have one-button mice. And that's how it started...
...even though I always thought Macs didn't have a left button?
it's dificult for common user
Oh, that's right... we want to make it more difficult for the average user! Now that's usability. ;)
disable (whatever it may be)
What about people who right-click on links to open them in new windows? Or those who right-click to go back to the previous page? Or those who don't use IE? ...or right-click to copy a text snippet? Or select text to print it?
You're trying to tell yourself that you're doing something good, when in reality what you're doing completely messes your page up. You're breaking your page, making it not work... removing the normal behavior.
Besides, if your content (or design) is that awesome... Then you're currently making good money off it... and then you would know that all you really need is a good lawyer and copyright protection.
No matter how you're trying to justify these fishy ways of breaking the visitor's browser -- nothing is a good reason.
What about in the instance that you have a series of session variables stored and the session times out. Without editing the timeout setting if you want to redirect the user to the home page to reselect their session variables, would it be bad practice to disable the back button here?
I'm using sessions on tons of pages... and I never disable anything. If they want to click back -- go ahead! If the session times out all the session data gets deleted... So they won't be able to "revive" an old session anyway...
Don't break the browser -- Provide a solution instead
True, if you allow your pages to be cached this won't help, since clicking back will just serve up the cached page... So you need to disable caching for session related pages.
the user will click the back button and doesn't realize they have to recreate their data query.
That's just lazy programming. When the user submits form data, you need to capture that data. When I go back, I expect the data to be there.
On most of the big sites, ebay, amazon, priceline, etc. they do this. I wrote this into my web applications as well.
Rather than break the browser, write the code so it works like you want it to work.