阻止图片下载 [英] Precluding the Downloading of Pictures

查看:58
本文介绍了阻止图片下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




JavaScript中是否有某种方法可以停止从

网页下载图片?


谢谢。


Doug van Vianen

解决方案

Doug van Vianen写道:

JavaScript中是否有某种方法可以停止从
网页下载图片?




编号为什么你问吗?

PointedEars


Thomas''PointedEars''Lahn在2006年1月12日下午3:01发表以下声明:< blockquote class =post_quotes> Doug van Vianen写道:

JavaScript中是否有某种方法可以停止从
网页下载图片?

没有。




肯定有。


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


我敢打赌停止在上一页加载图片。


或者,遍历图像集合并将所有src属性设置为'''';

它将停止下载它们。

为什么你问?




也许是因为他想知道?

-

Randy

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /


Randy Webb写道:

托马斯''PointedEars'' Lahn在2006年1月12日下午3:01发表以下内容:

Doug van Vianen写道:

在JavaScript中是否有某种方法可以停止从<一个网页?没有。



肯定有。

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

我敢打赌停止在上一页加载图像。




当然可以,但是如果你考虑一下,OP也不大可能是

想要停止加载当前文档。

或者,循环遍历images集合并将所有src属性设置为'''';
它将停止下载它们。




在文档加载完成之前,你无法可靠地访问DOM树,包括document.images

集合,所以你不能

可靠地防止图像加载。


这让我们留下:不。(惊喜!)

PointedEars


Hi,

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

Thank you.

Doug van Vianen

解决方案

Doug van Vianen wrote:

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



No. Why do you ask?
PointedEars


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

Doug van Vianen wrote:

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

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?
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Randy Webb wrote:

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

Doug van Vianen wrote:

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



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


这篇关于阻止图片下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆