This component has been removed from the platform in Firefox 29. (bug 953124)

The openLocationLastURL.jsm JavaScript code module lets you set and retrieve the URL most recently opened using the "Open Location" option in the File menu.

To use this, you first need to import the code module into your JavaScript scope:


Once you've imported the module, you can then use the OpenLocationLastURL object it exports. This object lets you fetch and change the URL that is placed in the "Open Location" dialog box when it opens.

If the user is not in private browsing mode, this automatically updates the value of the general.open_location.last_url preference.

Note: This module automatically handles private browsing mode for you. The value preserved across accesses is not preserved when the user exits private browsing mode.

Using the OpenLocationLastURL object

To get or set the value of the Open Location edit box, simply read the value of, or set the value of, the OpenLocationLastURL.value field:

var url = OpenLocationLastURL.value;

OpenLocationLastURL.value = ""; 

To reset the value of the edit box to the default (which is an empty string), you can call the reset() method:

Method overview




The reset() method resets the saved URL to the default, which is an empty string.



See also