need javascript to disable right-click

They have: 15 posts

Joined: Aug 2004

i saw this site in the website critique area - http://www.zghy.com.cn/

i've noticed that right-click is disabled without any annoying pop-up saying 'right-click disabled' and you cannot view source.

the best thing is that you cannot even save the page !

i saw this script a few weeks ago searching in the net but i don't know where i saved it.

can anyone please help. i need exactly these scripts (disable right click without any notice + disable view source + disable page saving options).

much thanks ^ PUI

openmind's picture

He has: 945 posts

Joined: Aug 2001

And the point would be?

I was able to view the source quite easily in Mozilla.

If someone want to look at the source, they will and there's little point in trying to stop them. As has been said many times before here, if it's that private, don't put it on the net!

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Although someone may hit me for giving you the following code, I wanted to give it to you to show that I was able to view source (to actually get it) by right clicking.

<script event=oncontextmenu for=document>return false;</script>
<script event=onselectstart for=document>return false;</script>
'

Oh and BTW, I was able to save... and I'm not too sure that is what you are looking either.

openmind's picture

He has: 945 posts

Joined: Aug 2001

**slaps renegade around the head**

Smiling

Theres the point. Even though the script"tries" to hide the source it can be got round so why waste your time!

KarenArt's picture

She has: 354 posts

Joined: May 2001

As a Mac user, I feel it's my obligation to point out that...
disabling right-clicking and view source doesn't work for us.
Nahh nahh nahh nahh nahh nahh... Sticking out tongue Smiling

Here is a good article for why you might not want to do this http://www.sitepoint.com/article/dont-disable-right-click. They also give you some very good alternatives that you may not have thought of.

gotta finish redesigning my sites so I can show them again.

The purpose of education is... to get more jokes!

openmind's picture

He has: 945 posts

Joined: Aug 2001

Aaaahhh The amazing one fingered operators!! Wink

KarenArt's picture

She has: 354 posts

Joined: May 2001

flipper wrote: Aaaahhh The amazing one fingered operators!! Wink

Yes... but the secret is... which finger do you use... Wink

He has: 578 posts

Joined: Jun 2004

first AND second!

They have: 15 posts

Joined: Aug 2004

flipper - the point would be to study. i am learning html and understand scripts.

Renegade - i use windows explorer. right click, view source and save was off. are the scripts in the head or body ? please pm me

thanks everyone for the replies Smiling

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I think I found thecode in the

openmind's picture

He has: 945 posts

Joined: Aug 2001

Quote: first AND second

I suppose you could use all four! Smiling

Quote: flipper - the point would be to study. i am learning html and understand scripts

Fair enuff.

He has: 578 posts

Joined: Jun 2004

That would be a bit odd... Anyone else use two fingers on a mac mouse?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.