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

Enable right click

Status
Not open for further replies.

glenmac

Technical User
Jul 3, 2002
947
CA
This little bookmarklet enables the right click menu on pages that have it blocked.
Code:
javascript:void(document.onmousedown=null);void(document.onclick=null);void(document.oncontextmenu=null)
Just to show how easy it is to foil no right click blocking scripts. To all those that are trying to protect thier code pictures excetra take note.

Glen
 
Interesting, how do you set it up as a bookmark?
 
If your using IE create a favorite, favorites/addto favorites of any page. Name it something you'll remember.
Right click on the favorite you created/ properties change the url to the bookmarklet code ignore the warning given. Done.
The next time you encounter a "norightclick" page click on the bookmarklet you've created and you will be able to view the right click menu ( in most cases not on mine ;-)).

Glen
 
Pretty slick!

...in most cases not on mine

I assume there's still a way around it, eh? [thumbsup]
 
To counteract the right click disabling, all you have to do when the alert box pops up is hit the Enter key on the keyboard while maintaining the right mouse button down, and the alert will disappear and the context menu will pop up. This is an old trick to bypass those people who think they can protect their code and pictures like that.

Lee
 

Although that doesn't work with the oncontextenu event, as you have to lift the RMB for the event to fire.

Dan

 
Or better yet, surf with javascript disabled. Why would I want to run anyones script without spesifically disgnating my disre to do so...

That is, I wouldn't want websites willy nilly running executables, because that would be insecure, so why should I execute their scripts (really there is no difference)? I do trust my JVM as there have been very few programs smart enough to escape Java's sandbox (I can think of once or twice that I've heard of it happening -- and there were patches in no time to fix the exploits), but JavaScript is natoriously insecure.

//end rant
 

JavaScript is natoriously insecure

Surely it is the way the individual browsers choose to interpret JavaScript code and expose their own functionality and various DOM properties / methods that is the insecure thing, rather than JavaScript itself?

Dan

 
Granted that it is a problem with the browsers, but there are no standards for the language. It's still burning my cycles running your code which (if I was jowe average) I may not know is happening. And disabling it stops people from:
- taking away right click
- assulting me with annoying scrolling marquee effects
- spamming my screen with menu-less tool-less pop-ups

Browsers are less than perfect, as are all things, and browser developers have a lot of issues to work on. JS would be nice if it weren't so abused, and browsers handled it better (more secure and more consistent).
 
A note about the bookmarklet:

It works in mozilla 1.0 as well. Create a copy of a bookmark you alredy have (right click>copy .... then right click anywhere on the bookmarks menu and paste).

then right click on the copy of the bookmark and hit properties. Paste the code in the url box and type a different name for the bookmarklet.

Here is an example of someone who has gone to tremendous efforts to protect their code:
view source......they have escaped the entire page and use javascript print(unescape(...)) statements to write out their page

seems like alot of work to me....

Robert Carpenter
"You and I have need of the strongest spell that can be found to wake us from the evil enchantment of worldliness." - C.S. Lewis (The Weight of Glory)

robert (at) robertcarpenter (dot) net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top