Hi all,
i have found the script of [B]disable right click only for images
I cant fix it with my java knowledge, i need your help. ?
The script is from [URL=http://www.dynamicdrive.com/dynamicindex9/noright2.htm]here
[CODE]<script language=”JavaScript1.2″>
/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.comf
*/
var clickmessage=”Right click disabled on images!”
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName==”IMG”){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName==”IMG”){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
i did that, but...
after removing "alert(clickmessage)"; lines the script became useless, i can right click on pictures ?[/QUOTE]
[code=php]<script type="text/javascript">
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
event.button=1;
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
e.which = 1
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
e.which=1;
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
[/code]
What gives me the right to "break" your browser is that i am the owner of my site. the visitors can leave my site, if they dislike the way it works. [/QUOTE]
actually i am not breaking something anyway, it is only a part of my design[/QUOTE]
By the way you can choose a browser that is "unbreakable", if this kind of small java scripts irritates you.[/QUOTE]
I know that the pictures are downloaded to visitors machine, even without this, a visitor can easily steal my images with PrintScreen button. But when something evil is unavoidable, why should i made it easier to abuse? i will do my best to stop image stealers, dissuasion is one of the ways. [/QUOTE]
"if you're so worried just don't upload them in the first place": first of all you should understand this is impossible and childish.[/QUOTE]
add watermarks(feint text with the name of your site on), this will reduce the atempts to steal them, of course someone could edit them and remove it, but that's unlikely.[/QUOTE]
it's not childish. it's how the web works. you publish something online, it's open to all. sourcecode, images, attachments, are all available to the surfer, casual or otherwise. if you don't want to be part of that, then don't upload. the web was not designed to hide its content.
i do understand where you're comig from, I just don't agree with your solution. disabling features of a browser is not right. period. and no matter how you dress it up as a site protection, you are still infringing on the end-users' ability to surf unimpeded.
childish? if there's any growing up to do it is those who think that just because they own a website they also own those who visit the site.[/QUOTE]
I design banners in photoshop and have managed to disable the right-click "Save as" option. Why the hell shouldn't I?[/QUOTE]
0.1.9 — BETA 6.17