Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

openLocationLastURL.jsm

Nos bénévoles n'ont pas encore traduit cet article en Français. Aidez-nous à réaliser cette tâche !

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:

Components.utils.import("resource:///modules/openLocationLastURL.jsm");

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 = "https://www.mozilla.org/"; 

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

Method overview

reset()

Methods

reset

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

reset();
Parameters

None.

See also

Étiquettes et contributeurs liés au document

 Contributeurs à cette page : arai, teoli, Sheppy
 Dernière mise à jour par : arai,