325252525252 Posted July 10, 2013 Share Posted July 10, 2013 (edited) <script language="javascript"> function click() { if (event.button==2) { alert('© 2003-2013 All rights reserved') } } document.onmousedown=click </script> script works just fine, can someone make it to be quiet no left click. I don't want that message. i can't script myself thanks for your help! Edited July 10, 2013 by 325252525252 Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/ Share on other sites More sharing options...
325252525252 Posted July 10, 2013 Author Share Posted July 10, 2013 or if anyone have more advanced scripts that would be helpful as well! Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440187 Share on other sites More sharing options...
codefossa Posted July 10, 2013 Share Posted July 10, 2013 No left click on the whole document? Then you couldn't click links or anything. You would have to have a single page site, or make exceptions for everything you want to click. I don't see the point of blocking a left click though. Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440194 Share on other sites More sharing options...
325252525252 Posted July 10, 2013 Author Share Posted July 10, 2013 (edited) sorry right click silly me ! Edited July 10, 2013 by 325252525252 Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440216 Share on other sites More sharing options...
325252525252 Posted July 10, 2013 Author Share Posted July 10, 2013 just tell me what can we replace alert('Sorry, this function is disabled.') with that script would still work but no message would appear thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440218 Share on other sites More sharing options...
kicken Posted July 10, 2013 Share Posted July 10, 2013 return falseNow, as for your whole idea: Anti-right-click scripts are nothing more than an annoyance and won't stop anyone from taking your images/source if they to. The only thing such a script will do is annoy the hell out of your visitors by preventing them from using their context menu for legit purposes such as opening a link in a new tab/window. Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440222 Share on other sites More sharing options...
325252525252 Posted July 10, 2013 Author Share Posted July 10, 2013 <body oncontextmenu="return false;"> FULL SCRIPT IF ANYONE ELSE NEEDS IT:) WORKS PERFECT Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440229 Share on other sites More sharing options...
codefossa Posted July 10, 2013 Share Posted July 10, 2013 FULL SCRIPT IF ANYONE ELSE NEEDS IT:) WORKS PERFECT Just a note. The all caps and mix of big/small letters is irritating to people who have troubles reading. You should really also listen to kricken. Disabling right-click to protect your source is useless. It doesn't even stop most people who don't understand well how things work, since in just about every popular browser, it's an option in the menu. For people who do, JS ain't going to do anything anyway, as if we were to want to scrape or anything like that, it's not even executed. I use right-clicks all the time for copying links and whatnot. Opening links in a new tab I do with a middle-click, but you're also blocking people who do right-click to copy and paste, and many other legit reasons. Blocking right-clicks should stay in the past, because there's no good use for it any more. Quote Link to comment https://forums.phpfreaks.com/topic/280041-left-mouse-click-disable/#findComment-1440234 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.