共用方式為


onerror event

Event handler provided if an error has taken place.

 

Syntax

HTML Attribute <element onerror = "handler(event)">
Event Property object.onerror = handler;
addEventListener Method object.addEventListener("onerror", handler, useCapture)

 

Event handler parameters

  • handler [in]
    Type: Function

    Event handler

Remarks

This event can be generated by the following errors:

  • The manifest referred to a 404 or 410 page, preventing the page from being loaded.
  • A page referenced in the manifest failed to download properly.
  • A fatal error occurred while downloading the resources listed in the manifest.
  • The manifest was changed while the update was being processed.

If there is more than one event, the error event will be the last one in the sequence.

Alternatively, you could use an anonymous delegate function such as

object.onerror = function (e) { … }

where e is the cached event.