Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need a code to disable source viewing.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need a code to disable right-clicking and view - source
in the menu. :)
 
actually you can't disable view source
but you can capture the onrightclick event, and then blur - so the user won't have the contextual menu
but the user will still be able to use the standard menu to view source
 
If you add a script that stops the right click and make a frames page, they will not be able to get the source in the main body by clicking. The only sources they will be able to get are the frame info and navbar.

BUT....if they're smart enough, they can always go into their history or temp files and get it. This does deter the majority of people though.

erasmuse
 
there is absolutely no way to hide your source from everyone. adam@aauser.com
 
... and anyway, no reason to hide the source code from everyone ;-)
 
disable right click (in IE5.5):

function returnFalse()
{
return false;
}

document.body.oncontextmenu=returnFalse

that will only disable right click though as above mentioned jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top