Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Javascript : No Right Click Script !@


13 replies to this topic

#1 pixelstat

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 09 August 2006 - 06:02 AM

This script will help you to protect your source code

Add this to <BODY> Section of your site !


<script language=JavaScript>

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>


Thank You !

Notice from BuffaloHELP:
Use proper bbcode tags when posting codes. We have Programming > Javascript dedicated section. Moving.


#2 mynitr

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 31 posts

Posted 10 August 2006 - 05:35 AM

Thanks for the script. But if you do a web search, you can find many more similar scripts with advanced functionalities along with "no right click".

#3 FirefoxRocks

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 274 posts
  • Gender:Male
  • Location:Ontario, Canada, North America, Planet Earth
  • myCENT:88.65

Posted 14 August 2006 - 10:10 PM

Does it work when you press CTRL+F3 in Opera?
What about CTRL+U in Netscape and Firefox?
Will it block View > Source in most browsers?

I haven't tried it yet. Just consider saying "Block Right-click Menu" instead of "Protect your Source Code". That way people will be less confused.

#4 delivi

    Trap Grand Marshal Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,320 posts

Posted 14 August 2006 - 11:13 PM

This script is widely availabe in the net. Try to get some script that makes it not possible to view the code using, View> Source.

#5 gaea

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 206 posts
  • Location:Vermont or Boston (USA)
  • myCENT:54.10

Posted 14 August 2006 - 11:25 PM

I've seen this type of script before. In my opinion it is kinda useless. I say this mostly because in virtually every browser you can click on the "View" menu and then choose "Page Source" from the list...which will accomplish the exact same thing.

As a matter of fact, I don't believe I've ever seen this code deployed on a professional site...usually only on hastily made blogs, etc.

I hand code all my pages, and honestly wouldn't really care if someone copied pieces of the code (ignoring php for a moment). Most of the time it is entirely specific to my page, so the amount of effort required to change/contort it into being used in something else would probably be close to just rewriting it from scratch. As they say, "limitation is the highest form of compliment."

If you are really concerned about keeping the coding of your site secure then you should either a) encrypt the entire thing and then parse it through a filter (this will greatly increase the cpu usage on your server, as well as requiring more time for the page to load); or B) purposefully write incredibly convoluted code that no one but yourself can understand (which is a waste of time, and probably won't be nearly as efficient as a correctly written page would be). In other words, I'd say both options are kind of a waste of time.

Just my 2cents.

Edited by gaea, 14 August 2006 - 11:31 PM.


#6 Plenoptic

    Trap Double Mocha Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 2,310 posts
  • Gender:Male
  • Location:That one place over there...
  • Interests:baseball, webdesign, computer programming, more to be added later
  • myCENT:24.66

Posted 14 August 2006 - 11:40 PM

Ya I have used that before but the Control + C still usually works for the ones I have tested anyway. I don't know if there will ever be a fool proof script that can keep people from copying but that does help. You just have to find a way to stop from the selecting of text on a screen like making it into pictures but that would take too much time.

#7 Mich

    Trap17 Maverick

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,272 posts
  • Gender:Female
  • Location:Michigan, USA
  • Interests:Please visit my personal homepage for all my interests http://www.mygardenofpromise.websetsbydonna.com
  • myCENT:7

Posted 15 August 2006 - 12:20 AM

In most cases, at least those persons using iExplorer, you can save the whole page including all graphics by going up to File> Save As. There are so many tricks to copying sites I don't see how it can be totally prevented. But, remember, it is a great compliment when somebody wants to imitate your work. <_<

#8 TypoMage

    Master of All Typos

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 621 posts
  • Gender:Male
  • Location:Earth, Usa, Maine, Waterford,
  • Interests:Creating websites.Playing sports. And also chating online.<br />Oh and............. Staying at Trap!
  • Spam Patrol

Posted 15 August 2006 - 01:38 AM

Hmm Disabling right click. I ahve heard of that. I tried right clicking one time. I message poped up saying Hahaha Nice try no doing that here. But it is still possible to copy ever piece of that Site. Easily. Unless you are not smart enough too.

#9 hype

    Legend Killer

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 723 posts
  • Gender:Male
  • Location:Singapore
  • myCENT:40.70

Posted 16 August 2006 - 11:05 AM

This script actually is used to fool internet users that have little experience in it... Practically, all of us here knows how to work our way around with it, with a simple View --> Source method! Perhaps its better without the script so as to save the loading time of your webpages... <_<

#10 Lyon2

    The Ethical Hacker

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,335 posts
  • Gender:Male
  • Location:Portugal (Europe)
  • Interests:Flash Clocks Website<br />http://flash-clocks.com<br /><br />My Work and Family.
  • myCENT:59.69

Posted 16 August 2006 - 02:56 PM

I know a trick to bypass that protection code, of course you can just click the edit menu or whatever and then click view source code, and that works in many browsers, but my trick does not use that, it is a trick with the keyboard buttons.

The trick:
Right click in any part of the page
Then a box will appear saying that you can't do it, or whatever
Then don't release the right click
at the same time, click ok with the left mouse without releasing the right click, then release the right click, and voila, the right click functions will appear.

Anyway, the best is to encrypt the source code of the page, not only for protect your work, but also to protect yourself from the google hackers.

#11 masterio

    Newbie [Level 3]

  • Kontributors
  • PipPipPip
  • 49 posts

Posted 27 August 2006 - 11:23 AM

If you want to hide your HTML Source, giving some 'disabled right clicks function' is not enough. If user want to see your source, it means he knew HTML and trick like that will not stopping them.

Just click View->Page Source, your source will come out!. So the better method you can use is to encrypt your HTML source using HTML encryptor. I think you've heard about it right?.

Just go to uncle google, then type 'HTML Encryptor' or may be 'Free HTML Encryptor' (I'm poor men...! LOL)

Edited by masterio, 27 August 2006 - 11:28 AM.


#12 michaelper22

    -=Hybrid Bus=-

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 742 posts
  • Gender:Male
  • Location:My hybrid bus (in NYC), a computer
  • Interests:Not interested in anything
  • Spam Patrol

Posted 30 August 2006 - 04:53 PM

I have seen these scripts before; they are totally useless in any browser other than IE. With these "other browsers", you can very easily disable changing of right click actions. In short, there are very few (but still some existant) ways to secure your source code.

#13 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 23 May 2008 - 06:05 AM

Can not disable Right Click in opera
Javascript : No Right Click Script !@

From m y experience I came to know that Opera browser doesn't support any scripts tht are written to disable right click. I there is a way to disable right click in opera pls share it... This would be very helpful

-reply by kalyan

#14 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 21 November 2009 - 11:14 AM

hey guys why not make a full flash website? this way if any1 tries to copy they have to do it the harder way (if theres a way) and if they really imitate it that means urs is nice(so they spend hell lot of time trying to copy) and your just wasting that guy's time... Plus flash provides great versatility and interactivity!-reply by some1




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users