Javascript image “onabort” event not firing in Firefox & Chrome

dom-eventsfirefoxjavascript

I'm trying to work out how to get the onabort event of an image element to work. From reading the docs it's meant to fire when a loading page is stopped either from clicking the stop button or firing the stop event.

I can get the following code snippet to work in IE but not in any of the other browsers. What am I doing wrong?

<html>
<head>
</head>
<body>
    <script type="text/javascript">
        function load(e) {
            alert('img loaded');
        }
        function onaborthandle() {
            alert('on abort hadnle');
        }
        
        function abort() {
            if (window.stop) {
                window.stop();
            }
            else {
                document.execCommand("Stop", false);
            }
        }
    </script>

    <img id="testimg" onabort="alert('abort inline');" />
    
    <script type="text/javascript">
        var img = document.getElementById('testimg');
        
        img.onload = load;
        img.src = 'http://sstatic.net/so/img/logo.png';
        
        abort();
    </script>
</body>
</html>

Best Answer

nothing is wrong, onabort and onerror are not supported in ff, and apparently in chrome too. although I read somewhere that the event will not work on local system files, but on files hosted on the web, not sure about it.