PDA

View Full Version : How to disable the right mouse button?


Moleiro
10-27-2005, 12:24 PM
Can anybody help me disabling the right mouse button in pixelpost?
I'm new to php, i've tried to disable the right click by javascript in my image_template.html , and in the preview of the file html it works just fine, but then when I run pixepost seems that the script gets ignored, I guess it's related with index.php.

Any help please?


Thank's in advance.

Joe[y]
10-27-2005, 01:03 PM
you could try using the php function - echo - (you'll see it around index.php so should be able to learn that little bit yourself) to include the javascript into index.php itself.

i don't understand why it doesn't work through the templates though! that's odd.

Moleiro
10-27-2005, 01:50 PM
As a begginer I tried to understand the echo function and I guess the basics I understood, but i guess it's a little bit harder integrate the javascript code in the index.php.

This is the javascript I'm trying to use:

<script language="JavaScript">
function click() {
if (event.button==2||event.button==3) {
alert('Right click not allowed, All rights reserverd.')
}
}
document.onmousedown=click
</script>

Can anyone give me a little help using this code in the index.php file?
The code works perfectly in the image_template.html file, but won't work when I run pixelpost.

Thanks

Joe[y]
10-27-2005, 02:01 PM
i can't see why this shouldn't work in atemplate - even the simple template uses JS in it.

there is possibly something wrong with the script itself?

by the way - this method is not a very effective way of preventing image thievery and to be honest is just plain annoying when users like me want to right click or something to open a new tab.

Moleiro
10-27-2005, 02:08 PM
I made it, thought i did it other way. And this way the user won't get the Copyright message, but at least my photos will not be stolen and posted in other fotologs, wich is a thing that happens a lot.

So to everyone that for some purpose want to disable the right mouse button just add inside your <body> this:

<body oncontextmenu=" return false" onselectstart=" return true" ondragstart=" return false">

Hope it helps. If anyone knows how to integrate the other code with the warning pop up message, that i showed in my previous post, I would appreciate it.

Thanks.

Connie
10-27-2005, 02:58 PM
well, why would you disable basic functions of the browser? Not many users do like that and it won't help you anything as all images which yo present in a website are stored in the cache of the user's browser.

So your idea just annoys many users or your site but does not protect your image. A better protection of your image would be:

- watermark
- exif-data with info about your copyright
- other image data with info about your copyright (I forget the name, TPC?)

plus: a photo prepared for a website is always in so bad resolution that it can be recycled only in other webpages...

plus: if you do disable the right context-menu, others will just hotlink your image and steel your bandwidth from their pages

so this disabling is not very helpful, some people even call it bullshit ;=)

Joe[y]
10-27-2005, 10:31 PM
yeah. i go crazy when i come across a photoblog with no right clicking. i never go back! lol

not that i steal images ... but i do use right click for things like links and stuff.

blinking8s
10-28-2005, 02:49 AM
']yeah. i go crazy when i come across a photoblog with no right clicking. i never go back! lol

not that i steal images ... but i do use right click for things like links and stuff.

same, i rarely go back to places that are all hardcore about right click and stuff

raminia
10-28-2005, 07:45 AM
same, i rarely go back to places that are all hardcore about right click and stuff
me2
:rolleyes: