OS | Browser | "" | null | remove | delete | stop | StopImage | Stop | Button | Timeout |
---|---|---|---|---|---|---|---|---|---|---|
Windows | IE6,7,8 | √(e) | √(e) | II | × | × | × | × | × | 21s (e) |
FF4,5 | II | II | II | × | II | × | × | II | 21s (e) | |
Chrome12 | × | × | × | × | II | × | × | II | 21s (e) | |
Safari4,5 | × | × | × | × | II | × | × | II | 21s (e) | |
Opera9 | × | √(e) | × | × | II | × | × | II | 47s (e) | |
Opera11 | II | √(e) | II | II | II | × | × | II | 47s (e) | |
Mac OS X | Safari5 | × | × | × | × | II | × | × | II | 1.2m (e) |
Chrome12 | × | × | × | × | II | × | × | II | 1.2m (e) | |
FF4,5 | II | II | II | × | II | × | × | II | 1m'15s (e) | |
Ubuntu | FF4,5 | II | II | II | × | II | × | × | 3m'9s (e) | |
Chrom(e/ium)12 | × | × | × | × | II | × | × | 3.2m (e) |
- Windows XP, Server 2003, 7.
- Mac OS X 10.6.7
- Ubuntu 11.04
标题注解:
""img.src = ""nullimg.src = nullrevmoveimg.removeAttribute("src")deletedelete img["src"]stopwindow.stop()StopImagedocument.execCommand("StopImage")Stopdocument.execCommand("Stop")ButtonBrowser Stop Button.图标注解:
√能够 Abort 图片请求,并回调 (e)onerror/(a)onabort/(l)onload 函数。II能够 Abort 图片请求,但不触发任何事件进行回调。≈部分版本支持。如 Stop/StopImage 在 .NET Framework 3.0 中取消了支持。×不能 Abort 图片请求,或不支持该方法。事件回调
var img = new Image(); img.onload = function(){out.innerHTML += "loaded.";}; img.onabort = function(){out.innerHTML += "aborted.";}; img.onerror = function(){out.innerHTML += "errored.";}; window.setTimeout(function(){ out.innerHTML += "before."; // abort. img.src = null; out.innerHTML += "after." + img.complete; }, 2000);
测试结果:
IEbefore.errored.after.Operabefore.after.errored.FFbefore.after.Chromebefore.after.Safaribefore.after.See Also
- http://stackoverflow.com/questions/930237/javascript-cancel-stop-image-requests
- http://www.sysopt.com/forum/archive/index.php/t-177147.html
- http://stackoverflow.com/questions/1671717/javascript-image-onabort-event-not-firing-in-firefox-chrome
- http://stackoverflow.com/questions/4506160/abort-active-image-requests
- http://www.devguru.com/technologies/ecmascript/quickref/image.html
- Javascript: Cancel/Stop Image Requests
- Can't you stop images from loading?
- window.stop()
- execCommand
- IE6下链接ONCLICK事件处理中的请求被ABORTED
- What does (Aborted) mean in HttpWatch? 来源
- http://blog.httpwatch.com/2007/11/20/error_internet_invalid_url-httpwatch/
- HttpWatch工具简介及使用技巧
转自:http://blog.hotoo.me/abort-image-request.html