Skip to main content
onsave Event

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

Fires from a persisted element when the Web page is saved or bookmarked, or when the user navigates away from the page.


Event Propertyobject.onsave = handler;
attachEventobject. attachEvent( "onsave", handler);Internet Explorer only
Named script <SCRIPT FOR = object EVENT = onsave> Internet Explorer only

Event Information

To invoke
  • Save the Web page.
  • Bookmark the Web page.
  • Navigate to another page.
Default action Initiates any action associated with this script.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query the event object for the following event properties.

Available Properties

srcElement Gets or sets the object that fired the event.

Refer to the specific event object for additional event properties.


This example shows how to use the onsave event for a persistence behavior.

<META NAME="save" CONTENT="favorite">
   .saveFavorite {behavior:url(#default#savefavorite);}
   function fnSaveInput(){
      alert("The onsave event fired.");
   function fnLoadInput(){
<INPUT class=saveFavorite onsave="fnSaveInput()" onload="fnLoadInput()" 
    type=text id=oPersistInput>

Code example:

Applies To

saveFavorite, saveHistory, saveSnapshot