Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent others from downloading html page

Status
Not open for further replies.

Rachel80

Programmer
May 25, 2000
63
GB
i have a homepage where i uploaded many photos but i dun wish to let visitors download them (such as right-clicking the mouse and click 'Save Image As'). I wanna trigger a Javascript alert message upon detecting the mouse(right-clicking) so as to inform the visitor that contents of the site could not be downloaded etc..
 
You can't stop them from downloading ... that's how a browser works! It downloads the page contents to the users machines browser cache and displays the page from there. You certainly can disable right-click, but as I sa, the images will still be in the users browser cache.

Why have pictures on your homepage if you don't want people to see them? One solution may be to put all your image pages & images in a directory which is not viewable by anyone but yourself (easy to do if your site is hosted on Unix - not sure about MS though).

Greg.
 
Yes, I mean I wanna disable the right-click..
It's not I dun want pple to see the pics, just not to let others save a copy..
So do u know how to disable the right-click?
Thanks!
 
If they've seen the pics, then they've saved a copy (even if they're not aware of it). A browser must download the image to display it.

You can disable the right-click, but what prevents them from disabling javascript? Or just typing in the path to the image?

As grega suggested, if you want to keep people from seeing your images and you need to have them on a web host, put them in a directory where the user doesn't have permission to read them or password protect the directory. There's no way that you can allow the user to view the images but not allow them to save them.

There are tons of threads in here that discuss this issue, why not try a search on "disable right click" ?

Russ
bobbitts@hotmail.com
 
<script>

function returnFalse()
{
return false
}
document.oncontextmenu=returnFalse

</script> jared@aauser.com
 
<!-- RIGHT MOUSE ALERT DISABLE -->
<script language=&quot;JavaScript1.2&quot;>
if (document.all)
document.body.onmousedown=new Function(&quot;if (event.button==2)alert('Bla Bla Bla, Bla, Bla, Bla!')&quot;)
</script>
<!-- END RIGHT MOUSE ALERT DISABLE -->
 
okay, thanx a lot!
I shall know what to do now :)
 
As rbobbit and grega stated... you can't lock them out. However, here is a nice JavaScript by Martin Webb. Don't forget they can turn off JavaScript. This script is like leaving your purse in the car and locking the doors. You just keep the << honest >> people out:

// -- Original: Martin Webb (martin@irt.org) -->

// -- This script and many more are available free online at -->
// -- The JavaScript Source!! -->

// -- Begin
function right(e) {
if (navigator.appName == 'Netscape' &amp;&amp;
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &amp;&amp;
(event.button == 2 || event.button == 3)) {
alert(&quot;Sorry, no right clicking allowed here.&quot;);
return false;
}
return true;
}

document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// -- End
 
I don't have a way to test this at the moment, so correct me if I'm wrong, but won't the following cause errors in pre javascript 1.2 browsers?

document.onmousedown=right;
window.onmousedown=right;

I guess if it does, an easy fix is to enclose it with the right version:

<script language=&quot;javascript1.2&quot;>
<!--

// ...

//->
</script>

Yes, leaving the purse in the car indeed. Even if the user has Javascript enabled, if his/her browser doesn't support Javascript 1.2 this does nothing.

Russ
bobbitts@hotmail.com
 
How can visitors to a site (that contains both pictures and text) be prevented from copying, downloading or printing the text part of it? I do not care about pictures. The idea is to permit them to read only. No copy, no download, no print. I am fully aware that nothing will stop the sophisticated computer guru. My aim is directed to the majority of visitors.

Thank you for your help.
 
Can't be done.
And:
Why would you do that?

Anyway:
Just generate an image that
contains your text with any
programming language.
Include the image in your
html - file.

Or make the image yourself
in Photoshop or in whichever program,
include it in your html - page.

But honestly - if you don't want
people to copy or print your
text - then don't publish it
on the Internet.

Buraje


 
Buraje:

Thank you for your answer and the tips. I agree that the text, as part of a picture, will not be possible to select, thus copied. But I think it can be printed. How can I prevent the page from being printed? Incidentally, there is a valid perpose for all of this.
 
hi

even when the right click is disabled, if the visitor sees the correct path of the pic file, he can directly type it as the url and download it. atleast, this is what i do when the disable right click.

luv
Karthik.
Pearls and Diamonds are not found on surfaces.
 
An easier and quicker way to get an image even if the right click is disabled is to drag the image to the address bar, this shows you the image from your temp internet files.

As mentioned before, there are loads of threads regarding this and loads of different ideas but no way will prevent this from someone who knows what they are doing, only from complete novices...

Hope this helps Wullie

 
I think what she orignally wants to know is how to do this....go to and go to view party pics. Pick any picture and you can't download it to use. I had a friend in charge of uploading them. I'm not sure what they use but It works for novices for sure.

:)
hope this helps with the ideas on how to solve your problem
 
ksgirl2,

not sure what you mean, but i can save any low-res photo to my machine. in fact, it's already there in my temp internet files.

the high-res pics are protected by virtue of them being displayed through a plugin &quot;mirage viewer&quot;


=========================================================
while (!succeed) try();
-jeff
 
As far as the photos go, some people use digital watermarks, to prevent the use of their pictures by others.

For example

Click on the bird and you'll see the watermark. Still isn't the complete answer you're looking for. But hope it helps someone :)

Jewel

When faced with a decision, always ask, 'Which would be the most fun?'
 
This is an issue that will continue to be asked. As everyone above has said, there is simply no way you can prevent anyone with some knowledge getting access to images or text (Print Scrn button, html source, direct URL, disable Javascript, internet cache etc).

A few other methods that will provide a bit of security:

1. Create a table, set the respective image as the background, then stick a transparent gif in the foreground.

2. Slice up the image into loads of small bits, then rebuild in the page so it looks like a whole one.

3. Use transparent layer to cover the image to prevent click-and-save (this could also be applied to text).

4. Use Flash to display your image, setting the protection from import property.

5. Watermarks.

Maybe using some of those (or a combination) will help.
 
You have two groups of people in life. Hawks and doves.

It doesn't matter how intelligent the dove arguments are for not not doing something because hawks think they are right and others are just idiots for not agreeing.

Heck if hawks are told by doves that it is dumb to do such a thing they think they can prove them wrong by doing the stupid thing and make them look stupid.

&quot;What? You say I'm about to do something stupid? It can't be stupid since I want to do it! I'll show you!!! Ha ha look I did it!! Mwaa haaa haa&quot;

It doesn't matter if doves tell hawks that it creates a great deal of other problems and really doesn't fix the problem they set out to do.

Hawks will do as they want regardless of doves and common sense. Stand proud hawks you are doing useless stuff! :)

I challenge all the hawks to show me a way to STOP me from grabing their images that is full proof not just a mere nuisance.

Gary Haran
==========================
 
You might want to change

Code:
alert(&quot;Sorry, no right clicking allowed here.&quot;);

to

Code:
alert(&quot;Sorry, no left-handed people allowed here.&quot;);

or

Code:
alert(&quot;This site optimized for right-handed people who aren't very smart!  If you're left-handed, or in possession of a bit of brains, downgrade now by beating at your head with your left hand until both are relatively useless!&quot;);

[lol] I'll take Gary's offer even further -- suggest a legitimate reason for wanting to prevent right-handed stupid people from accessing these images and files that are presented online via a public web server.

smart and sinisterly,


[monkey] Edward [monkey]

Like Lovecraft? Know Photoshop? Got time for the Unspeakable?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top