Sets or retrieves a pointer to the event handler function associated with the onbeforeunload event.
HRESULT IHTMLWindow2::get_onbeforeunload(VARIANT *p);HRESULT IHTMLWindow2::put_onbeforeunload(VARIANT v);
- Pointer to a variable of type VARIANT of type VT_DISPATCH that receives the IDispatch interface of an object with a default method that is invoked when the event occurs.
- VARIANT of type VT_DISPATCH that specifies the IDispatch interface of an object with a default method that is invoked when the event occurs.
Returns S_OK if successful, or an error value otherwise.
The handler for this event can return a string that prompts the user to cancel or continue the unload operation. The user is then prompted with a dialog box that shows two buttons, along with the returned string:
- Ok — the unload operation proceeds.
- Cancel — the navigation unload is cancelled.