Created
June 23, 2011 08:07
-
-
Save hotoo/1042132 to your computer and use it in GitHub Desktop.
test abort image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <meta name="keywords" content="" /> | |
| <meta name="description" content="" /> | |
| <meta name="generator" content="gvim" /> | |
| <meta name="author" content="闲耘™ (hotoo.cn[AT]gmail.com)" /> | |
| <title>Image.Abort</title> | |
| </head> | |
| <body> | |
| <button onclick="img = null;">img = null</button> | |
| <button onclick="img.src = '';">img.src = ""</button> | |
| <button onclick="img.src = null;">img.src = null</button> | |
| <button onclick="img.removeAttribute('src')">img.removeAttribute("src")</button> | |
| <button onclick="delete img['src'];">delete img["src"]</button> | |
| <button onclick="window.stop()">window.stop()</button> | |
| <button onclick="document.execCommand('StopImage', false)">document.execCommand("StopImage")</button> | |
| <button onclick="document.execCommand('Stop', false)">document.execCommand("Stop")</button> | |
| <div id="output">output:<br /></div> | |
| <script type="text/javascript">/*<![CDATA[*/ | |
| var output = document.getElementById("output"); | |
| var img = new Image(1,1); | |
| img.onload = function(){output.innerHTML += "loaded: "+(new Date()-start)+"<br />";}; | |
| img.onerror = function(){output.innerHTML += "error: "+(new Date()-start)+"<br />";}; | |
| img.onabort = function(){output.innerHTML += "abort: "+(new Date()-start)+"<br />";}; | |
| //img.src = "http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey.jpg"; | |
| //img.src = "http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/window.jpg"; | |
| //img.src = "http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/whidbey2.jpg"; | |
| function send(){ | |
| img.src = "http://free-92-208.alipay.net:7788/m.gif"; | |
| window.setTimeout(function(){ | |
| // Linux(YES): FF4, Chrome12. | |
| // Mac(YES): FF4. | |
| // Mac(NO): Safari5, Chrome12. | |
| // Win(YES): IE8, FF4. | |
| // Win(NO): Chrome12. | |
| //img.src = ""; | |
| // Linux(YES): FF4. | |
| // Linux(NO): Chrome12. | |
| // Mac(YES): FF4. | |
| // Mac(NO): Safari5, Chrome12. | |
| //img.src = null; | |
| // Linux(NO): FF4, Chrome12. | |
| // Mac(NO): Safari5, FF4, Chrome12. | |
| //delete img.src; | |
| //img.removeAttribute("src"); | |
| // Linux(YES): FF4. | |
| // Linux(NO): Chrome12. | |
| // Mac(YES): Safari5, FF4, Chrome12. | |
| //window.stop(); | |
| }, 2000); | |
| } | |
| var start = new Date(); | |
| send(); | |
| /*]]>*/</script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment