openLocationLastURL.jsm 编辑

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 = "http://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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:71 次

字数:2882

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文