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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right clik disable - how to do it? 7

Status
Not open for further replies.

Aishaa

Technical User
Apr 12, 2001
90
0
0
CA
Hi I know there is a post on this I saw long time ago on here, but nothing came up on my search.....

Anyways I would really like to know how to do this.....
Can anyone tell me how?

Ty
Aisha
 
Hi,

You can find a version at
Just be aware that any visitor with a little computer knowledge can still get any content off of your pages.

If you are trying to stop someone stealing your images, all they need to do is drag the image to the address bar and they will see the image that is stored in their temporary internet files on their computer.

Hope this helps Wullie

 
Aishaa, you can do a no-right click javascript, you can get a copy of that here: htpp:// in the downloads section...but wullie is right, anyone who really wants to can still get you're image, try putting a copyright on the images via use of photoshop, ok?? I have not failed; I merely found 100,000 different ways of not succeding...
 
Using the cleardot.gif trick can be useful if your just trying to protect images, but like its been said, you only need a bit of computer knowledge to get the images anyway.
 
Hi - actually I am trying to stop people from being able to read my code.

Will people be able to get hold of my code/view source somehow if I right-clik disable?

Thanx......Aishaa
 
Sorry, They can still get your code by using the view>source on the browser..

You can make it hard to get the code(Encrypting etc.) but you won`t stop anyone with a bit of computer knowledge.

Hope this helps Wullie

 
How do they view source if I have right clik disabled it?
 
Disabling the right click function omly affects the actual main browser window, it does not stop a user from using the tabs on the top of their browser....

VIEW>SOURCE

There are also other ways to do it, by running an external page validator is just one of the ways. This will not be affected by a disabled right click.

Hope this helps Wullie

 
A trick I have used on some of my sites is to open the page you want to stop them from stealing the code in using a popup window, but disabling the menu bars hence preventing them from using VIEW > SOURCE.

<a href=&quot;#&quot; onClick=&quot;MyWindow=window.open('redirect.htm','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=???,height=???'); return false;&quot;>

Team this with a right click disable script on the page and the vast majority of users will struggle to get your code.


I know most people don`t like popups but if you want to disable the whole of the site, have a splash screen and launch a full screen popup from there which will prevent any further popups. hmm, ok, confusing myself now!

 
Aishaa, another trick i'm aware of is placing like hunderd's of empty hard returns' on you're coding so the user thinks that there's no code...i've seen some sites do that...
I think that the code should be shared, that's how I learned how to do programming by looking at other ppl. coding and modyfing it, and if someone wants to learn from me then so be it...i only use the righ-click on my site to protect my images that I crated... I have not failed; I merely found 100,000 different ways of not succeding...
 
Hi rufc
I pasted this
<a href=&quot;#&quot; onClick=&quot;MyWindow=window.open('redirect.htm','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=???,height=???'); return false;&quot;>

in between the head and /head of my page, but it has not worked - am still able to view source from top browser tabs. What am i doing wrong?

Ty
Aishaa
 
Hi Aishaa, hi all,

I agree with all the members who say that's it's impossible to hide your code or whatever for users with a bit computer knowledge.

I also share the opinion that we all learned coding from reading other people's/company's sites. And we have to keep on sharing our knowledge.

But I also respect your opinion and let you decide for yourself what you think the best is for you, so here are some previous threads. Take the time to read it and see for your self. (try also a key-word search for yourself)

thread216-56027

thread216-107271

thread216-26455

thread216-58052

thread216-28398


Good luck,
Erik
 
Hi all,

I totally agree that code should not be hidden as most of us (including me) have learned and still learn from other sites.

As I mentioned before, running an external validator on the page in question will return the source code no matter what right click script or other trick mentioned.

You are trying to hide your source code. This means that it is going to be other designers that you are hiding it from, the people you are hiding the code from are going to have knowledge of how to get the code even if you open an external window with the toolbars removed and a disabled right click.

The point I put to you is, where would we all be if all of our code was kept secret? This forum for one, would only have a few posts on it. Nobody would help others as they wouldn`t want to give away their secrets...

I personally have only been designing sites for about a year and wouldn`t have been if I hadn`t picked up code snippets here and there and also if I hadn`t had this forum.. Tek-tips has been invaluable to me...

You could put all the tricks mentioned together and add some more, some people might not get your code, but I guarantee that if you post the url here someone will get your source code quicker than you disabled it..

Something to think about....

Hope this helps Wullie

 
Disable scripts only work (someofthetime) with PC's. It doesn't work on MAC's. And I agree, like everyone says one can still get the stuff they want from your page.
You could try putting your images in Applets.
You could try encrypting your whole page
And still they can get stuff from your page.
It's only a fun novel idea for beginners.

'my 2 cents'
cheers!
mxw
 
Aishaa,

try replacing the ??? with the actual pixel size of the window you want to open, and also use the code as a usual a href code (so it goes before the link you want to open in a new window)(also needs a closing /a tag)

Regarding the 'should we share our code' debates, I myself learnt everything I know from other peoples sites andreading books and readily leave my code open for anyone to take a look at.

BUT, on some occasions I have spent hours creating a new unique effect/layout to make my sites different from the rest, on these occasions I prefer to keep my coding secret (unless someone emails me asking for it in which case I have given it out in the past). I understand that many people can still get at code no matter what you do, but make it as hard as possible for them.
 
Just worth noting, it's bloody hard to reverse engineer a *.swf file, so if your really paranoid about your code, try doing your entire site in flash. Of course, that brings in a whole host of other problems, but thats another debate! :) &quot;The surest sign that intelligent life exists elsewhere in the universe is that it has never tried to contact us&quot;
Bill Watterson, Calvin & Hobbes
 
Well...since we're talking about hiding code, I'm gonna mention that you could also use a script, and load the entire page into a variable and then use insertAdjacentHTML to display the page. You could then have the script in an external file, or even multiple different files with lots of functions all calling each other that just load a couple of variables. Users can still see the code but you can make it really hard to find out what it's doing.

Mike
 
MNClimber, boy that's alot to do especialy for someone who wants to hide thier coding...I still believe that unless the coding is not sensitive information, it shouldn't be hidden...alot of start-up programmer's actually learn programming (javascript, HTML, vbScript) from looking at other people's coding then they do from reading those books or taking classes...
Maybe that's just my opinion... I have not failed; I merely found 100,000 different ways of not succeding...
 
I agree that code shouldn't be hidden too.......
I just need it for this one little bitsy site on request lol...

Ty
Aishaa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top