gpt4 book ai didi

javascript - 附加组件 SDK Mozilla Firefox currentURI

转载 作者:行者123 更新时间:2023-11-30 08:07:52 24 4
gpt4 key购买 nike

我使用 https://addons.mozilla.org/en-US/developers/builder (附加组件构建器)我尝试做以下事情:

1.如何改变currentURI地址?方法 setTabURL() 不适用,因为会立即打开 URL。

虽然找到了出路:

tab.attach ({
contentScript: "history.pushState ('','', '" + tab.url + "');",
});

2.如何获取地址栏输入的url地址?方法getTabURL()只显示结算地址。

3.如何给工具栏中的图标添加文字?我在这里使用它:https://builder.addons.mozilla.org/package/166563/

最佳答案

要访问 URL 栏及其相关值,您必须深入了解浏览器 chrome。

此代码片段将为当前获得焦点的浏览器窗口获取/设置 URL 栏值:

var wuntils = require('sdk/window/utils');
var document = wuntils.getMostRecentBrowserWindow().document;
// log the current URL bar value
console.log(document.getElementById("urlbar").value);
// change the current URL bar value (this won't change the page)
document.getElementById("urlbar").value = "Thrift Shop";

关于javascript - 附加组件 SDK Mozilla Firefox currentURI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15009161/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com