LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-18-2001, 01:10 AM   #1
Marci Sarwan
LQ Newbie
 
Registered: Jan 2001
Location: Canada, Toronto
Posts: 17

Rep: Reputation: 0
Unhappy


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!
 
Old 01-18-2001, 09:18 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Exclamation

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]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript help darin3200 General 4 09-03-2005 11:58 PM
Javascript maseby Programming 1 04-09-2004 05:16 PM
javascript in <td>? akaash Programming 0 03-18-2004 12:22 AM
JavaScript TextAreas jacksmash Programming 9 12-27-2003 01:02 PM
Help with javascript? BajaNick Linux - Software 2 07-20-2003 08:41 PM


All times are GMT -5. The time now is 12:33 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration