Precluding the Downloading of Pictures

D

Doug van Vianen

Hi,

Is there some way in JavaScript to stop the downloading of pictures from a
web page?

Thank you.

Doug van Vianen
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 1/12/2006 3:01 PM:
Doug van Vianen wrote:




No.

Sure there is.

document.location.href = 'someOtherPage.html';

I bet that stops the images from loading in the previous page.

Or, loop through the images collection and set all src properties to '';
and it will stop downloading them.
Why do you ask?

Maybe because he wanted to know?
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 1/12/2006 3:01 PM:

Sure there is.

document.location.href = 'someOtherPage.html';

I bet that stops the images from loading in the previous page.

Sure, but if you think about it, it is highly unlikely that the OP also
wants to stop the current document from being loaded.
Or, loop through the images collection and set all src properties to '';
and it will stop downloading them.

You cannot reliably access the DOM tree, including the document.images
collection, before the document has finished loading, so you cannot
reliably prevent the images from loading.

Which leaves us with: No. (Surprise!)


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 1/12/2006 3:54 PM:
Randy Webb wrote:




Sure, but if you think about it, it is highly unlikely that the OP also
wants to stop the current document from being loaded.

Not my decision to make. The question was asked if you could stop the
images from loading, you said No. I proved you wrong. Now, take it like
a man and move on.
You cannot reliably access the DOM tree, including the document.images
collection, before the document has finished loading, so you cannot
reliably prevent the images from loading.

Put it at the end of the document, do not use the onload. You should
test stuff before you babble your crap.
Which leaves us with: No. (Surprise!)

Yes I can, you just don't realize it.

Now, open a page with 200,000 image tags in it. Hit the STOP button on
the browser. Then come babble to me some more.
 
T

Thomas 'PointedEars' Lahn

Randy said:
Thomas 'PointedEars' Lahn said the following on 1/12/2006 3:54 PM:

Not my decision to make.

Providing nonsensical "solutions" such as this is not going to help anyone.
But then I doubt that was your intention; you are merely trolling here,
again. Can't you find some nice bag around to work out your aggressions?
The question was asked if you could stop the images from loading,

Yes, it was.
you said No.

Yes, I did.
I proved you wrong.

No, you did not. You talked about something that has a low probability of
being helpful at all, and then you talked about something that is far too
less reliable to qualify as a solution to the OP's problem.

And *I* _proved_ *you* wrong, every time.
[...]
You cannot reliably access the DOM tree, including the document.images
collection, before the document has finished loading, so you cannot
reliably prevent the images from loading.

Put it at the end of the document, do not use the onload. [...]

Makes no difference. Most of the images will already be loaded by then.
Which leaves us with: No. (Surprise!)

[...]
Now, open a page with 200,000 image tags in it. Hit the STOP button on
the browser. [...]

The OP asked:

| Is there some way in JavaScript to stop the downloading of pictures
| from a web page?

It was not asked:

"Is there some way to prevent pictures of a web page from being displayed?"


HTH & HAND

PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 1/12/2006 7:41 PM:
Randy Webb wrote:




Providing nonsensical "solutions" such as this is not going to help anyone.

I didn't offer it as a "solution". Call it a "proof of concept" as it
shows that you can indeed stop image loading via JS. Is it realistic?
No. But it can be done.
But then I doubt that was your intention; you are merely trolling here,
again.

I will take that as a compliment as it is coming from you. It is typical
of you that when you are wrong and get corrected and then proven wrong
that you call the person who corrected you a troll.
Yes, it was.


Yes, I did.



No, you did not. You talked about something that has a low probability of
being helpful at all, and then you talked about something that is far too
less reliable to qualify as a solution to the OP's problem.

Again, it was not posted as a "solution", but as a "proof of concept" to
show you that you can indeed stop it. Once again, not realistic but
possible.
And *I* _proved_ *you* wrong, every time.

I suppose that if your definition of wrong is that you are right, then
so be it.
[...]
Or, loop through the images collection and set all src properties to '';
and it will stop downloading them.

You cannot reliably access the DOM tree, including the document.images
collection, before the document has finished loading, so you cannot
reliably prevent the images from loading.

Put it at the end of the document, do not use the onload. [...]


Makes no difference. Most of the images will already be loaded by then.
Now, open a page with 200,000 image tags in it. Hit the STOP button on
the browser. [...]

Given your above comment about "most of the images will already be
loaded". Are you saying that your computer will download 200,000 images
before the browser reads the HTML file to the end?
The OP asked:

| Is there some way in JavaScript to stop the downloading of pictures
| from a web page?

It was not asked:

"Is there some way to prevent pictures of a web page from being displayed?"

And I did not answer that question. I corrected your incorrect answer.
Even though it is not realistic to do what I said you *could* do, it is
still technically possible and that makes your answer *WRONG*.

HAND
 
D

Doug van Vianen

Hi,

Oh oh! Sorry I asked now.

However, there are web sites that have web pages that do not let one
download pictures by right clicking on them and selecting Save image as....
I was just wondering how this was done. Maybe it was not done using
JavaScript.

Doug vV

Randy Webb said:
Thomas 'PointedEars' Lahn said the following on 1/12/2006 7:41 PM:
Randy Webb wrote:




Providing nonsensical "solutions" such as this is not going to help
anyone.

I didn't offer it as a "solution". Call it a "proof of concept" as it
shows that you can indeed stop image loading via JS. Is it realistic? No.
But it can be done.
But then I doubt that was your intention; you are merely trolling here,
again.

I will take that as a compliment as it is coming from you. It is typical
of you that when you are wrong and get corrected and then proven wrong
that you call the person who corrected you a troll.
Yes, it was.


Yes, I did.



No, you did not. You talked about something that has a low probability
of
being helpful at all, and then you talked about something that is far too
less reliable to qualify as a solution to the OP's problem.

Again, it was not posted as a "solution", but as a "proof of concept" to
show you that you can indeed stop it. Once again, not realistic but
possible.
And *I* _proved_ *you* wrong, every time.

I suppose that if your definition of wrong is that you are right, then so
be it.
[...]

Or, loop through the images collection and set all src properties to
'';
and it will stop downloading them.

You cannot reliably access the DOM tree, including the document.images
collection, before the document has finished loading, so you cannot
reliably prevent the images from loading.

Put it at the end of the document, do not use the onload. [...]


Makes no difference. Most of the images will already be loaded by then.
Now, open a page with 200,000 image tags in it. Hit the STOP button on
the browser. [...]

Given your above comment about "most of the images will already be
loaded". Are you saying that your computer will download 200,000 images
before the browser reads the HTML file to the end?
The OP asked:

| Is there some way in JavaScript to stop the downloading of pictures
| from a web page?

It was not asked:

"Is there some way to prevent pictures of a web page from being
displayed?"

And I did not answer that question. I corrected your incorrect answer.
Even though it is not realistic to do what I said you *could* do, it is
still technically possible and that makes your answer *WRONG*.

HAND

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices -
http://www.JavascriptToolbox.com/bestpractices/
 
T

Thomas 'PointedEars' Lahn

Doug said:
Oh oh! Sorry I asked now.

No need for /you/ to apologize for asking. Some people on Usenet,
called trolls, just like to provoke others. Unfortunately, most of
the time Randy does not do anything else here.
However, there are web sites that have web pages that do not let one
download pictures by right clicking on them and selecting Save image
as.... I was just wondering how this was done. Maybe it was not done
using JavaScript.

Ahhh -- the ambiguity of the word "download" :) What you mean refers
to a different kind of download than was discussed -- a _file_ download.
People that tried to prevent that, used client-side scripting. However,
you should not try to reproduce that. The main reason has already been
mentioned: the images are downloaded to the local cache when the document
is loaded (they could not be displayed otherwise), so preventing a second
download will not change anything. See the archives for details and
further cons.
[Top post]

This /is/ a reason for you to apologize, though.


PointedEars
 
R

Randy Webb

Thomas 'PointedEars' Lahn said the following on 1/13/2006 2:38 PM:
No need for /you/ to apologize for asking. Some people on Usenet,
called trolls, just like to provoke others. Unfortunately, most of
the time Randy does not do anything else here.

Another compliment from you I see. Thanks. That makes 2 and I didn't
even have to invoke this one other than by proving you wrong. But, that
is to be expected from you.
 
L

Lee

Doug van Vianen said:
Hi,

Oh oh! Sorry I asked now.

However, there are web sites that have web pages that do not let one
download pictures by right clicking on them and selecting Save image as....

There are sites that stop some people, using some browsers.
What's the point? It's like locking your door but leaving
your window open, because some burglars might try the door
and go away.

Find one of those sites and look at the source to see how
they did it.
 
?

__. ___ _. __.. ___

Doug said:
However, there are web sites that have web pages that do
not let one download pictures...

If they don't let you download the image file, how is your
browser supposed to guess what the image looks like?
:)

If you see the image on your screen, it means that the image
file *has* been downloaded. You just have to know where to
look. The cache.
 
J

Jason S

Doug said:
However, there are web sites that have web pages that do not let one
download pictures by right clicking on them and selecting Save image as....
I was just wondering how this was done. Maybe it was not done using
JavaScript.

flickr.com does this in some circumstances by using a transparent GIF,
I believe they have a 1pixel by 1pixel transparent GIF which they
resize & place on top of the image in question, so your right-clicking
accesses the gif and not the real image.

it is a hindrance but doesn't stop someone from getting the real image
if they really want to. (easiest way is to look at the HTML source,
then find the image in question, assuming it's not dynamically loaded,
and type in the URL into your browser)

in order to stop someone from saving an image Y.jpg which is displayed
on the screen when webpage X.htm is downloaded, you'd have to have some
method which closes the following "loopholes":

(1) ctrl+printscreen, paste into favorite drawing application
(2) the manually-look-at-the-source method mentioned above
(3) use curl.exe (or some other non-browser application) to act
identically to a standard browser & access the server, download the
webpage X.htm (& its referenced images), and save image accordingly.

Some of my state's registries of deeds use a fancy Java application to
display images from their scanned-in archive w/o allowing any direct
access to images (to get around this you'd have to figure out how to
extract the images from whatever binary image encoding format this app
is using). They want you to pay $$$ in order to be able to print the
images in question -- but you can still use Ctrl-Printscreen to get a
(perhaps) lower-quality copy.
 
T

Thomas 'PointedEars' Lahn

Jasen said:
var x,y=document.getElementsByTagName("img");

The `document.images' collection exists and is far more compatible.
for( x=0;x<y.length;x++)document.wry[x].src="";

This is utter nonsense. There is no `wry' property for the `document'
object until you create one, and until then it certainly does not refer
to an element object collection.

However, either approach has already been disqualified as a solution
to the problem. Even if it was the OP's intention to hide all images
_he_ referred to in _his_ document -- which would not make much sense,
would it? -- a) it would still be possible to download them and
b) without the required client-side script and DOM support nothing
would be prevented from anything.

This is not your first time to add late to a discussion without any
regard as to what was already discussed. Especially if you have
such a slow newsfeed in .nz, you should read the entire discussion
(considering the filters you may have set) before posting a followup.
The intention of a posting always should be to contribute something
new to the discussion.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Jasen said:
what has that to do with my response?

It and its precursor clarify that the OP is looking for a way
to prevent explicit image file download.
it does not come before the message I was replying to.

True. So you should not have replied this in the first place.
arrived here Jan 14 07:32:48 UTC

Injected by me into the NetNews peering system on

| Date: Fri, 13 Jan 2006 20:38:22 +0100

or Jan 13 19:38:22 GMT, which was more than 10 hours(!) before.
(BTW: UTC is _not_ the same as GMT.)
the above (by me) was written 14 Jan 2006 07:03:46 UTC

Huh? You replied to it _before_ you received it? :)
news.free.net.nz (which for some reason does not appear in the path line)
delays incoming news.

I expected that to be so because of the timing of your responses. And as
I said, then you should LART your NetNews service provider to improve their
feed configuration or change to a faster provider. Because with such a
slow newsfeed the probability of you adding a new aspect to a discussion
is low, and the probability of duplicate answers on your part is high.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Jasen said:
Jasen said:
Is there some way in JavaScript to stop the downloading of pictures
from a web page?
[...]
for( x=0;x<y.length;x++)document.wry[x].src="";
This is utter nonsense.

somehow that line got mangled after I pasted it in. it should have been

for( x=0;x<y.length;x++)y[x].src="";

ACK. As for optimization:

for (var x = y.length; x--;)
{
y[x].src = "";
}

You see that I also moved the declaration of x to the loop it is used in.
BTW, I prefer `i' and its successors in the latin alphabet as identifiers
for the iterator.

Note that assigning the empty string may result in another HTTP request, and
may not do what you expect. Because if the value of the HTMLImageElement
interface attribute `src' is regarded as a URI reference as standardized in
W3C DOM Level 2 HTML, the empty URI reference refers to the referring
resource, that is the current document here. Since that is not an image
resource, usually nothing is displayed; however, it could also happen
rightfully that a "broken image" icon is displayed instead.

<URL:http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268>
He didn't say that the script was for his doccument. maybe it was for a
bookmarklet?

If that were so, a bookmarklet, even if evaluated in time, could not prevent
image download with this because the bookmarklet could not be used before
the document was loaded.
he didn't say that.

Pardon? He wanted to prevent the download in the first place.
he asked in a javascript newsgroup.

JS/ECMAScript support does not imply the respective DOM support, which is
why feature tests are necessary on run-time.
It's a server problem. the ISP is running leafnode, the config they are
using delays the content of messages for AFAICT atleast 60 minutes.

If what you say is true, they delay it for more than 10 hours. Which is why
I strongly recommend(ed) that you either LART them or switch the NetNews
provider.


PointedEars
 
T

Thomas 'PointedEars' Lahn

Thomas said:
Injected by me into the NetNews peering system on

| Date: Fri, 13 Jan 2006 20:38:22 +0100

or Jan 13 19:38:22 GMT, which was more than 10 hours(!) before.
(BTW: UTC is not the same as GMT.)


Huh? You replied to it _before_ you received it? :)

Forget about this particular response of mine. I see your point know.
(Hopefully you see mine, too.)


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top