Jaa


returnValue property

Gets or sets a value that indicates whether to warn the user prior to navigating away from a page.

 

Syntax

HRESULT value = object.put_returnValue( v);HRESULT value = object.get_returnValue(* p);

Property values

Type: VARIANT

Error Message

Display Error Message before unloading the document.

VARIANT_FALSE (false)

Display a default warning dialog box.

VARIANT_TRUE (true)

Default. Unload the document without warning the user.

Standards information

Remarks

The HTMLWindowEvents::onbeforeunload event allows you to warn a user who is navigating away from a page or closing the browser. Set the return value to VARIANT_FALSE or a VARIANT of type VT_BSTR value to cancel the document unload event. You can also return a string or VARIANT_BOOL value from the event handler to display a message to the user, who is asked to confirm that they want to unload the document.

The warning dialog box in Windows Internet Explorer 9 is easier to read than in earlier versions. In the improved dialog box, it is easier to distinguish the default text from text provided by the website, and large buttons clearly indicate how to stay on the page or navigate away.