vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Prevent right click menu (https://vborg.vbsupport.ru/showthread.php?t=104061)

bashy 12-30-2005 08:02 PM

Prevent right click menu
 
Hi peeps

I want to be able to prevent peeps from using the Right Click Menu, to limit/restritc peeps nicking stuff of me site, I have found this code (below)
Where would i put it, or is there something else i can do?

Regards

Bashy

Code:

<!-- TWO STEPS TO INSTALL NO RIGHT CLICK:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript1.1">
<!-- Original:  Martin Webb (martin@irt.org) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("Sorry, you do not have permission to right click.");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<center>[ Try right-clicking the image and then the text link below ]
<p>
<img src="http://javascript.internet.com/img/tjsbutton.gif">
<p>
<a href="http://javascript.internet.com">Text Link</a>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  1.57 KB -->


akanevsky 12-30-2005 09:10 PM

The best way to prevent clicks would be:
<body onload="self.close()">
That'll have the same exact effect on your board's users as if the clicks are simply disabled ;)

bashy 12-30-2005 09:24 PM

Cheers Psionic

Where exactly would this be placed?

Bashy

akanevsky 12-30-2005 09:29 PM

That would be placed in all templates that have a <body> tag, instead of the one they currently have.

bashy 12-30-2005 09:32 PM

Sounds like a bit of work involved then :(
Thought it might have just been 1 edit, although....

My forum is situated inside my portal, so in effect couldnt i just do this to the portal and the others would be effected because of this?

ResaleBroker 12-31-2005 12:28 AM

Quote:

Originally Posted by bashy
Sounds like a bit of work involved then :(
Thought it might have just been 1 edit, although....

My forum is situated inside my portal, so in effect couldnt i just do this to the portal and the others would be effected because of this?

For just one (1) edit you might add a script like the one I've included to your "headinclude".

Code:


<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
 
var message="WARNING! No portion of this website may be reproduced, copied, or transmitted in any form or by any means, except as a normal browser download without prior written permission from the publisher, except for usage allowed by the Fair Use provisions of the Digital Millennium Copyright Act.\n\nCopyright ? Your Name. All rights reserved.";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>

Of course, someone who really wants your code can get around a javascript but for the average Joe this should work just fine.

bashy 12-31-2005 06:12 AM

Thats brill, thanks alot :)

Happy New Year

Regards

Bashy

ResaleBroker 12-31-2005 12:48 PM

Quote:

Originally Posted by bashy
Thats brill, thanks alot :)

Happy New Year

Regards

Bashy

Happy New Year! :)

merk 12-31-2005 11:21 PM

If you didnt already get it, Psionic Vision was being sarcastic. Preventing the right click menu is the worst behaviour you could possibly add to your site, and youll find any tech-saavy users will immediatly be turned off your site.

There are ways around such "restrictions". You wont be stopping anyone from stealing your content.

Forumi Shqiptar 04-01-2006 07:21 AM

i need to disable right click to certain forums any chance on doing this???? Can someone please help me

many thanks

Freesteyelz 04-01-2006 11:20 AM

What is your purpose for disabling right-click? As merk mentioned it is rather useless if you're trying to prevent people from accessing your content. Is it for a different reason?

misuzuu 03-29-2008 10:57 PM

thanks alot for this =3

Opserty 03-29-2008 11:00 PM

NB This can be easily circumvented by disabling Javascript.

cheat-master30 03-29-2008 11:15 PM

This kind of thing is pretty much totally useless. Those who do want to steal stuff can probably bypass it easily, and those that don't will often be those frustrated by it. And how can it be circumvented? Easily:

1. Turn off Javascript

2. Use NoScript or another such add on

3. Use another addon to remove the code from the source of the page

4. Use a browser which doesn't support javascript

5. View source, find image, copy into address bar

6. Use Firefox (option to disable any interference with the context menu)

7. Keyboard shortcuts

8. Use Firefox or said browser to drag the image into the address bar, which opens it in a new tab or the like.

9. Print screen

Basically, it's USELESS as any attempted form of security. Why? Because there are about three billion ways to bypass it, anyone who really wants the files will get them anyway, and it ruins a lot of good functions for those trying to use your forum for normal posting.

Finally, I never understood what's with all the long scripts for this thing, since they basically all do the same thing, and a two line piece of code likely can do the exact same function...


All times are GMT. The time now is 02:53 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01153 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete