How to restrict visitors of mine website to do right click so that they do not copy paste mine content and cannot be able to see the source code .... I know there are some HTML codes but they are not working 100% its some mistakes in there HTML i think so ... But how can i restrict visitors of mine website to do right click for security reasons !!!!
add this under <body> tag. <script language=JavaScript> <!-- //Disable right mouse click Script var message="Right Click is disabled!"; /////////////////////////////////// function clickIE4(){ if (event.button==2){ alert(message); return false; } }
Don't bother. Anyone can use the menu at the top of their browser to view your code. You'll just end up pissing people off by using JS to disable right click.
If it needs to be that secure, it must NOT be put on the internets. There are many Javascripts to disabled right-click... and many of us just don't run Javascript. There are some HTML and CSS tricks, like making the HTML image a transparent gif and putting the real image as the background. You can't right-click to get the image, but you only have to look up the name in the CSS file. You can put all your text and images in a Flash file and force all your visitors to have Flash. This means people without Flash cannot see your site at all, and this includes Google (Google can read text and accessibility tags in Flash, but you can choose not to put these in the Flash file). The basic answer is, any solution you hear from someone on this board can be overcome, usually very easily. Grandma doesn't want to steal your content and she'll get confused why her right-click (which often has many useful menu options in it) doesn't work, but the nerd who likes stealing content knows how to use his browser and will always get your content. Jamesicus might come by and post that url where some clever guy hides his content in the most complicated way. I never figured out how to get to it but most of the nerds here learned how to do it quick enough. The page is there as a proof that if it's online, it's stealable, no matter what you try.
Here you go, Stomme poes: This puzzle is a great challenge -- a good way to test your web authoring skills and a nice diversion from "headache" coding sessions. It also illustrates the futility of trying to hide source code If you crack it, don't post your hidden message answer here just yet -- I will do so after a short while. http://www.drpeterjones.com/hidden/hidden.php Two other ways of easily viewing source code (and copying via CTRL C): 1. Run the page URL through a Markup Validator after specifying "show source" 2. Or - run the page URL through the Web-Sniffer HTTP Request and Response Header Viewer -- the source code is automatically displayed. By way of example, Here is the output for one of my pages in Firefox 2.0 James
Thanks for your suggestion my dear friends from above suggestions its clear that we cannot if we disable right click then also user can see it from the view tab or he can also can use any software to copy mine content ... o no its not good !!! i want some good suggestion for mine security of mine website !!!
If you are trying to protect images, just watermark them. Dont mess with the right-click thing. If it is text, Copyscape has a program that will help. http://copyscape.com. tlcmkt
Put this into <head> <script> var isNS = (navigator.appName == "Netscape") ? 1 : 0; if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP); function mischandler(){ return false; } function mousehandler(e){ var myevent = (isNS) ? e : event; var eventbutton = (isNS) ? myevent.which : myevent.button; if((eventbutton==2)||(eventbutton==3)) return false; } document.oncontextmenu = mischandler; document.onmousedown = mousehandler; document.onmouseup = mousehandler; </script> Or even more simple way.. <body oncontextmenu="return false;">
Any site that messes with my browser or mouse, even inserts popups asking if I need chat help or if I really want to leave site, gets an automatic veto. If I must, I'll alt-f4 or reboot to escape such arogant crap. There are better ways to protect content and prevent hijacking without infuriating viewers. I am slowly adding posts about web design at my new site www.securehtmlpagesinwordpresscms.com
To Disable right click put this code under <body> tag: <script language="JavaScript"> <!-- var message=""; /////////////////////////////////// function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </script> To Disable Highlight Text put this code under <body> tag. <script type="text/javascript"> //form tags to omit in NS6+: var omitformtags=["input", "textarea", "select"] omitformtags=omitformtags.join("|") function disableselect(e){ if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1) return false } function reEnable(){ return true } if (typeof document.onselectstart!="undefined") document.onselectstart=new Function ("return false") else{ document.onmousedown=disableselect document.onmouseup=reEnable } </script>
By disabling the right click action on your site, you'll only alienate visitors. If a semi experienced code thief wants to extract your content, then the will use the view menu or Ctrl U in FF for example. Images should contain a watermark if that's what your trying to protect, or use Copyscape for textual content. You have to decide what it is your trying to protect.
1. don't put it online in the first place : ) 2. make sure there's a log somewhere that can prove the time and date you put your content online. If someone else copies your text content, you can go complain to google, and use your timestamp to prove you had your content online first (or if google cached it before the theif posted their stolen copy, there's proof right there). Google is free to tell other search engines that the copy is to be ignored. The thief won't get google traffic at least. 3. tlcmkt said watermark your images. This is a good idea, and you can also only put low-resolution versions of your images online (if you are selling artwork, the buyer gets the full-sized, hi-rez version). I can Gimp around most watermarks, depending on the image, so having smaller versions is very good. 4. Sell your content to someone else, get your money's worth, and let the buyer worry about theives : ) Those are my tips. James: thanks for posting that! : )
Come on. Any spider/bot program can just bypass all your Javascript and scrape everything. And I agree with mugger, I take a very dim view of sites that mess with my right to right-click.