For a toolbar button click, I need to get the URL address of the active tab.
But
window.gBrowser.selectedBrowser.contentDocument
gets a CPOW
error.
How can I get the URL location of the active tab URL within an e10s add-on?
For a toolbar button click, I need to get the URL address of the active tab.
But
window.gBrowser.selectedBrowser.contentDocument
gets a CPOW
error.
How can I get the URL location of the active tab URL within an e10s add-on?
Copyright © 2021 Jogjafile Inc.
Looking around at the objects available, and in the source code, it looks like where you should get the URI for the active tab is:
From the current
nsIURI
:The object
window.gBrowser.currentURI
returns ansIURI
which has a number of properties from which you could get the URI, including:You can also get the
nsIURI
for the current selected tab as:From the
urlbar
:You could, of course, pull the URL out of the
urlbar
:Finding
window
:All of the above assume that you have set
window
appropriately to the currently active window. For example, by doing something like: