Jump to content

Disable Right Click?


kvnmck18

Recommended Posts

Anyone know how to disable a right click of the mouse? Or make the right click "act" like a left click??????

Link to comment
Share on other sites

You do know that's useless for hiding source code, right? So... what exactly you need it for then?And btw, it doesn't work in Opera.

Link to comment
Share on other sites

I need it for an app I made in Flash [sWF that's exported as an .EXE]. Apparently, through ActionScript there is no way to disable right click entirely. The app is being used in a kiosk, and I need a way to "trick" the AS to disable right click OR setup something in the computer that completely disables a right click (either it does nothing or it acts as a left click).Tricky?

Link to comment
Share on other sites

Also that link, I didn't try it but...I don't believe that would work when dealing with a .swf. SWFs usually override all browser functions, especially when it is being embedding through script itself.

Link to comment
Share on other sites

That may sound stupid, but how about buying a mouse with one button? I know such mice exist, but I have no idea where to buy them from nor how much they are worth, but I'm guessing they'll be cheap. If not, you might consider looking for someone to modify your mouse to such one.Since you have control over the physical machine where the app will be used, you could afford to do this.Also, IE can be run in kiosk mode by typing "iexplore -k http://example.com" from the command line (or the Run dialog). There are also free programs that turn IE into a kiosk which provide additional functionality to what the kiosk mode has to offer. Anyhow, even with the right click, there's nothing dangerous a user could do in Kiosk mode. Not without a keyboard anyway (in which case he can close IE with Alt+F4).

Link to comment
Share on other sites

This works in IE and Firefox:

document.oncontextmenu = function() { return false; };

But I like boen_robot's suggestion of buying a mouse with only one button if you are using this in a kiosk setting.

Link to comment
Share on other sites

boen, brilliant...as usual. A+ thinking. Thank you all :)

Link to comment
Share on other sites

You do not need to go through the trouble of buying a mouse with one button - just go to the control panel and set up your right click to have no functionality.

Link to comment
Share on other sites

You do not need to go through the trouble of buying a mouse with one button - just go to the control panel and set up your right click to have no functionality.
Where exactly do you do that from? I've looked everywhere in the mouse setting (including the Hardware>Properties ones) and couldn't find that. The closest was to switch the primary and secondary button, but that still enables right click by left clicking instead.
Link to comment
Share on other sites

I remember in Win 95 you could... but that just might have been because it was a different mouse....I think some mice(?) allow you to; when most don't....I hope I don't sound stupid....

Link to comment
Share on other sites

(ps - I tested the right click javascript...it doesn't work when you have a swf...as I thought)

Link to comment
Share on other sites

We do a lot of Flash production around here and we have not found a reliable way to disable right-clicking in a Flash movie. The Flash Player captures the right-click and does what it wants (shows the Flash menu). If all you want to do is detect that the user clicked the right button (it will still show the menu), you can use this code:

If(Key.isDown(2)){	trace("the right button is pressed!!");}You will need to run this in an onClipEvent(enterFrame) loop or, if you areusing Flash MX, with onEnterFrame or setInterval.onClipEvent (enterFrame) {var KEYVAL_right = 2;if (Key.isDown(KEYVAL_right)) {trace ("Thanks for pressing RIGHT");}}

You can remove some of the items that show up on the right-click menu with this:Stage.showMenu = false;But that does not remove the menu altogether (despite the name). If you don't want the menu to show at all, you will need to use a hacked version of the Flash player, which would not be legal in the eyes of Adobe.

Link to comment
Share on other sites

I use this:

var theMenu:ContextMenu = new ContextMenu();theMenu.hideBuiltInItems();_root.menu = theMenu;var item1:ContextMenuItem = new ContextMenuItem("-blah blha-", trace);theMenu.customItems[0] = item1;var item2:ContextMenuItem = new ContextMenuItem("fdgdfgdfg", trace);theMenu.customItems[1] = item2;Stage.showMenu = false;

Still has the "Setting"

Link to comment
Share on other sites

Yeah, like I said, there are items on the menu that you cannot remove. Since you can control the hardware, I would use a mouse where you can go into the control panel and set both buttons to be primary click. I can do that on mine, so that setting is hardware-dependent. Just get a mouse for a kiosk where you can control that.

Link to comment
Share on other sites

Where exactly do you do that from? I've looked everywhere in the mouse setting (including the Hardware>Properties ones) and couldn't find that. The closest was to switch the primary and secondary button, but that still enables right click by left clicking instead.
Looks like its not an option any more or at least with a standard mouse (or one that doesn't have software specifically for it)But, you could use this to edit teh system registry:
Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer]"NoViewContextMenu"=dword: 00000001

and that should disable the right click context menu all together.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...