LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   javascript?? (https://www.linuxquestions.org/questions/programming-9/javascript-623/)

Marci Sarwan 01-18-2001 01:10 AM

Hello,

does anyone know how to create a java script that will prevent people from righ-clicking on an image on my web site to copy the pic? Basically, I don't want people to copy the image on my web site by right-clicking on the image and saving the image. What I want to happen when the user right click on the image is to pop up a window and prompt the user that they're not allow to copy the image. Thank you!


Marci Sarwan (marci_sarwan@yahoo.com)

PS: Please include some sample code. Thanks!

trickykid 01-18-2001 09:18 AM

You can use the code off of one of my websites, but I haven't updated it but it doesn't work in Linux, or the new version of Netscape 6.0. But you can at least see waht it looks like and customize it to your tastes.

Drew

Here it is: goes after Title tags--

<SCRIPT LANGUAGE="JavaScript">


<!--
var message="Any message you want goes here";

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;
// End -->

</SCRIPT>

Hope this helps in any way. But remember unless you make it pop up in a different window with the option to use the menu 's up at the top of the browser windows, anyone can go t view and see the source...then they can see where you have the pic stored.

Drew

Sorry forgot to add this....

<body OnLoad="trap()\" BGCOLOR="#000000"> the onload functions needs to be in your body tag...

[Edited by trickykid on 01-18-2001 at 10:21 AM]


All times are GMT -5. The time now is 12:45 PM.