This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

abort

Summary

Fires when the user aborts the download.

Overview Table

Synchronous No
Bubbles No
Target dom/Element
Cancelable Yes
Default action Halts downloading of the designated image, but not due to an error
## Examples
<img id="imgLogo" title="Click to view larger image" src="example.com/small.jpg" alt="small logo"/>
<script type="text/javascript">
var myAddEvent=function(el, ev, fn){
    if(el.addEventListener){
        el.addEventListener(ev, fn, false);
    }else if(el.attachEvent){
        el.attachEvent('on'+ev,fn);
    }else{
        el['on'+ ev] = fn;
    }
};
var el=document.getElementById('imgLogo');
function imgAbortHandler(evt){
// code to recover from the abort method.
}
function imgResize(evt){
document.getElementById('imgLogo').src='http://example.com/big.jpj';
document.getElementById('imgLogo').title='big logo';
}
myAddEvent(el,'click',imgResize);
myAddEvent(el,'abort',imgAbortHandler);

Usage

 Used to recover the original resource if the user cancels the download.

Notes

Remarks

Halts downloading of the designated image, but not due to an error. To invoke this event, do one of the following:

  • Click an anchor while the document is loading.
  • Stop loading the document.
  • Navigate to another document.
  • Windows Internet Explorer 9. The client stops fetching media data, but not due to an error.

The pEvtObj parameter is required for the following interfaces:

  • HTMLAnchorEvents2
  • HTMLAreaEvents2
  • HTMLButtonElementEvents2
  • HTMLControlElementEvents2
  • HTMLDocumentEvents2
  • HTMLElementEvents2
  • HTMLFormElementEvents2
  • HTMLImgEvents2
  • HTMLFrameSiteEvents2
  • HTMLInputFileElementEvents2
  • HTMLInputImageEvents2
  • HTMLInputTextElementEvents2
  • HTMLLabelEvents2
  • HTMLLinkElementEvents2
  • HTMLMapEvents2
  • HTMLMarqueeElementEvents2
  • HTMLObjectElementEvents2
  • HTMLOptionButtonElementEvents2
  • HTMLScriptEvents2
  • HTMLSelectElementEvents2
  • HTMLStyleElementEvents2
  • HTMLTableEvents2
  • HTMLTextContainerEvents2
  • HTMLWindowEvents2
  • HTMLDocumentEvents4
  • HTMLElementEvents4

Syntax

Standards information

Event handler parameters

pEvtObj [in]
Type: ****IHTMLEventObj****

Attributions

  • Mozilla Developer Network cc-by-sa-small-wpd.svg: abort Article]

  • Microsoft Developer Network: [abort Event Article]