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


All times are GMT. The time now is 11:42 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.01049 seconds
  • Memory Usage 1,739KB
  • 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)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete