Jump to content
MakeWebGames

Recommended Posts

Posted

How come there isnt some snippet or code to stop right click around here ?

i found a couple ive used in html .

 

<body oncontextmenu="return false;">

 

 

<script language="JavaScript">
<!--
/*
No rightclick script v.2.5
(c) 1998 barts1000
[email protected]
Don't delete this header!
*/

var message="Sorry, that function is disabled.\nThis Page Copyrighted and\nImages and Text protected!\nALL RIGHTS RESERVED"; 

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// --> 

</script>
Posted

Because it doesn't stop people from being able to get the text + images .... so its a waste of code. You simply press f12 (on chrome) for example and its all there for that taking.

The same reason why you cannot hide you're page source, although there is a way to do it, its a waste of time people can still grab it with push of a single button on the keyboard.

Posted

Also you can always make a screen capture and then copy the image you want without even saying everybody can as well disable javascript and be able again to right click. Sorry but there is no way to protect you here.

Posted

There are instances where one would want to unhook a "right-click" event on web pages.

They may not be for the reasons you would use it for, but I'll give an example where it would be beneficial to stop right clicking:

You are running an emulated(no hardware requiring) application that attempts to have the UI(User Interface) match very closely to the real operating system.

This could be because of any reason, but mainly I would think if you ran an SaaS(Software as a Service) application with a custom client(web browser).

Now, right-clicking normally brings up an context menu with commonly used functions to a user's disposal.

These could potentially be appended to or replaced entirely, so it does something like create a CRUD(Create Read Update Delete) menu specific to the web site.

Other uses would be for uses in BB(browser based) Games, such as an FPS where right-click would be to dodge an attack or reload a weapon.

Although context menu's aren't supported(except Opera) at this time, there is some discussion going on about it.

Please see the following link for the proposed ideas: https://www.w3.org/Bugs/Public/show_bug.cgi?id=13608

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...