Free Web Hosting Forum
Go Back   Free Web Hosting Forum > Website Building > Scripts and Code Snippets
Reload this Page Code for no right click/highlighting text.
Reply
 
Thread Tools Display Modes
(#1 (permalink))
Old
agentlsk's Avatar
Member
agentlsk is on a distinguished road
 
Posts: 35
Join Date: Apr 2009
Location: USA
Default Code for no right click/highlighting text. - 06-07-2009, 10:42 PM

Here is a code to make it so no one can right click or highlight text on your website. (Although people can still disable javascript.)

Code:
<SCRIPT LANGUAGE="JavaScript" type="text/javascript" >
<!-- 
document.oncontextmenu = function() {return false}
if (document.layers) {
  window.captureEvents(Event.MOUSEDOWN);
  window.onmousedown = function(e) {
    if (e.target==document) return false;
  }
}
else {
  document.onmousedown = function() {return false}
}
//-->
</SCRIPT>
EDIT: I forgot to mention that this disables you from clicking/ typing in form boxes for some reason.

Last edited by agentlsk; 06-12-2009 at 04:30 AM. Reason: Forgot to tell.
Reply With Quote
(#2 (permalink))
Old
Junior Member
azams is on a distinguished road
 
Posts: 1
Join Date: Jun 2009
Default 06-08-2009, 11:13 PM

thanks bro.. i will use it on my web..
Reply With Quote
(#3 (permalink))
Old
Jordan's Avatar
Senior Member
Jordan is on a distinguished road
 
Posts: 1,856
Join Date: May 2008
Send a message via AIM to Jordan Send a message via MSN to Jordan
Default 06-08-2009, 11:16 PM

The thing to get around it is to say that if JavaScript is dissabled the site cant be used....


~Jordan

Bye
Reply With Quote
(#4 (permalink))
Old
Bad Karma[CORE]'s Avatar
Direct Admin
Bad Karma[CORE] is on a distinguished road
 
Posts: 5,924
Join Date: May 2008
Default 06-09-2009, 10:53 AM

So i enable Javascript, look at the source and copy the stuff i need. I donīt get the point in "oh, letīs disable right mouse button". There is no way you can stop people from getting to your source, even if you obfuscate your html code....
Reply With Quote
(#5 (permalink))
Old
Junior Member
dean is on a distinguished road
 
Posts: 26
Join Date: May 2009
Default 08-24-2009, 11:13 AM

Sites with no right click is really annoying, It's one of the things that helps to drive visitors away.
There's still a million ways for someone to steal pictures or whatever content your trying to protect on your site.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com