You do not understand how the Internet works. If they can see it, they have already downloaded it.
It has to be downloaded before they can see it. So the image is ALREADY on their computer by the time they can see it. They can then copy it by any of these methods:
- Right-click on the image and save it.
- Find the file in the cache and copy it.
- Find the file in the internet temporary files folder and copy it.
- Use ctrl-printscreen to put the image on the clipboard. Then paste it into MS-Paint.
- Switching off JavaScript in the browser prevents you from running scripts on their computers anyway.
If you don't want people copying your pictures, don't post them on a website.
You could put a thumbnail on the page, and download the full picture only if the person is logged in, but that requires a server-side script.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
Hi -
Yes, I understand what you are saying. I guess I should have explained further:
The images on my web pages are thumbnails linked to PDFs. I would like to password protect the PDFs. So if someone clicks on the link they would be prompted to input a generic user id and password. Once they did this they could continue to download other PDFs for a certain period of time.
I understand that it is possible to circumvent the password by looking at the code. The majority of my visitors, however, do not understand HTML well enough to do this. If they do then they are free to circumvent this simple protective measure.
Thanks,
AL
How is your ezine subscription implmented? You'll need to be able to retrieve the list of users subscribed to your ezine, and have them insert their email, and/or password before carrying on.
You'll need to use a server side to make this secure but if you're bent on just using plain old javascript then the basics are to have a list of the username and passwords, compare them, allow/deny access.
eg:
// your list of allowed usernames
var usernames = [
'joe',
'mary'
];
// prompt username, usually you use a form, or other UI but prompt() is simple
var username = prompt('Enter Your Username');
// iterate through each item in your list with the username
var auth = false;
for (var i = 0; i < usernames.length; i++) {
if ( usernames[i] == username) {
auth = true;
break;
}
}
If (auth == true) {
alert('you have access');
} else {
alert('no access');
}
You'll have to look into attaching an event handler to the link, and having the even handler (function) call a similar routine to the one above.
Then have the event handler stop propagation of the event if the authentication fails.
--
note: I didn't add passwords since that would be compromising your users passwords, as they will be visible in the HTML source.
You wouldn't want to user emails either, since they would be open to automated email harvesting for spam purposes.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101