Virtual Mechanics: Community Forums and FAQs
Virtual Mechanics: Community Forums and FAQs
WebDwarf, SiteSpinner, SiteSpinner Pro 'How do I...'
Disable mouse left-click...how ?|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Honorary Mechanic |
.
I guess need to disable mouse left-click. Have a look: HERE In the frame called "Mangos Music TV" There's buttons to select a certain program. when clicked the frame contents change...fine. Now if they would left-click and select "open in a new screen" they would get ONLY the new frame-contents in that new page whithout the rest of the main-page...this i DONT want ofcourse. So i thought to simply disable left-click by placing some code at least inside each frame...or maybe on the whole main-page. There is nothing on the whole website that needs a left-click anyway. ------------------ So the question is ------------------ 1) Do you have some code that disables left-click ? i guess a pop-up saying "bleep...left-click is disabled" is not needed/wanted. 2) An other solution to solve this ? Please think good if any solution will not cause unwanted lateral effects. or unwanted user-experience. Radio . |
||
|
|
Honorary 'Aussie' Mechanic |
Copy and paste the following code into the HEADER section.
<script language=JavaScript>
<!--
var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script> |
|||
|
|
Honorary Mechanic |
Thanks !
Could you explain a little what and how it does that ? Thats a big piece of code for something as little as that. (for learning and safety) |
|||
|
Guru 'Power' Mechanic![]() |
You maybe haven't seen a big piece of code!
It looks very similar to the many "prevent right-click" scripts available on the web. The apparent complexity comes from having to capture the mouse event in a manner that is compatible with most browsers. |
|||
|
|
Honorary 'Aussie' Mechanic |
Bruce is correct on both counts, especially in the fact that it is a very small piece of code.
Also, as Bruce says, most of the code determines the type of browser. I have tested this particular piece of code in a few browsers, and it works in IE, FireFox, Safari, and Google, but not in Opera. Probably with a bit of work, I could also add Opera to the test, but who uses that anyway? Most people use scripts like this to prevent people like us from viewing their source code, and/or, saving images from their site. A pointless exercise. For instance, in IE, you can go to Page > View Source to achieve the same result. Then you could find the image in the source code to retrieve it’s URL and download it (unless of course, the code has been encrypted). In your case, the purpose is different, as it’s use actually has a different application. Normally I do not promote disabling right click. The code does not actually determine if right or left mouse button is clicked, it is simply activated on mouse down (either button). It is then again only activated if the context menu is to appear (right click only). So, instead of displaying the context menu, it displays the message “”, in other words, nothing. |
|||
|
|
Honorary Mechanic |
Ok thank you.
I'll give it a try later let you know when it's done. |
|||
|
|
Working Mechanic |
This may help; it's what I've been using. May be more than needed here, or you'll probably get beter from the other members, but I'll throw my two cents in just in case.
<script language=JavaScript> <!-- var message=""; function clickIE() {if (document.all) {(message);return false;}} function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) { if (e.which==2||e.which==3) {(message);return false;}}} if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} document.oncontextmenu=new Function("return false") // --> </script> This is not my own, done in SS, but by someone else and came as part of a web set I purchased. Hope it helps. |
|||
|
|
Honorary Mechanic |
.
@ Gypsy, Your suggestred script is exactly the same as the above one...posted by postyr @ postyr & Brucee, I have it implemented and it works OK...check it: HERE A) Interested and curious i wonder how the buttons on top still react (mousedown/up) B) Also left-click in the video-area (FLASH) still works also (that's OK) and brings up the menu in there. Point (A) brings me to a possible different solution: If a "mousedown-left" would exist (and a "mousedown-right") You could have menubuttons that only react to mousedown-right But i guess such left/right-mousedown dont exist...or ? Also SS built-in fx cant discriminate between the two. Radio . |
|||
|
|
Honorary 'Aussie' Mechanic |
Hey Radio, you ask some strange questions.
First of all, the reason why my and Gypsy’s are the same is because we were both working on the same project at the same time. Secondly, the link you provided does not include the script. I can still right click and view the source. And no, you cannot difference between left or right mouse button (without getting into serious programming, which most are not web compatible). You can only apply a mouse move reaction on a mouse down. The script provided, as explained in an earlier post, detects which sub-menu is activated., not the actual mouse action. |
|||
|
|
Honorary Mechanic |
postyr,
The use of the script is to avoid: left-clicking on the buttons that are on top of the module (frame) called: "Mangos Music Tv" [LATIN] , [BRAZILIAN] ...etc So i applied the script on that frame (on the page(s)that is inside it) and that works now or not ? It was not intended and is not applied on the mainpage (or frames) as a measure to prevent viewing the source...that is not the issue. (yes i could later use it for that also) The only reason i use it right now is to prevent opening that "Mangos Music TV" frame separately (without the rest of the page) by right-clicking on one of these buttons > open in new page As i now have added the script that is now prevented. So the link as i provided does include the script...and it does work in the way i required/asked it at the top of this thread. Hope you understand/agree ? This message has been edited. Last edited by: radiotechscan, |
|||
|
|
Honorary 'Aussie' Mechanic |
Yes, my apologies. I did not think to check out the frame.
As the script achieves your purpose, all is fine in this world again. |
|||
|
|
Honorary Mechanic |
Okidoki...
i corrected/edited some instances where i said "left-click" ..which should be "right-click" ofcourse. Still wondering how it is still possible to do right-clicks inside the video-area and still get a working menu. Must be that this script does not affect flash-objects ? Or maybe that this script is strictly directed at the opening/preventing of browser pages (document ?) where the Flash-menu is not a page ? |
|||
|
|
Working Mechanic |
Good evening RTS;
Please accept my most humble apologies here. As you can see, I too have been the benefactor of Postyr's most extensive and beneficial knowledge. I can honestly say that if not for his wisdom and that of others on this site, I would not be here today. I will also try to be more thorough in my reading of posts, before replying. Sincerely, Gypsy This message has been edited. Last edited by: Gypsy Miles From Nowhere, |
|||
|
|
Honorary Mechanic |
Good morning to you too
|
|||
|
|
Honorary 'Aussie' Mechanic |
Gypsy, no harm done, thanks for your support.
Radio, I understood the right-left click stuff. The script only affects the page that it’s on, and the objects included in it. I haven’t had the time to check your site again, but if the video area is in a different frame again, you would need to include the script there as well. Having said that, if the items in the video area have links attached, they will still work, so I presume the right click directly on the object would also still work. |
|||
|
|
Honorary Mechanic |
.
The script is in the same frame-contents that also includes the video-player...so obviously it does not influence the clicking on the player dont know why...but actually that is just perfect. Thanks again ! |
|||
|
| Powered by Eve Community |
| Please Wait. Your request is being processed... |
|

