Get the current document address (Firefox extension)
The accepted answer here is wrong, but the related comment is much closer.
The phsr FAQ linked to "Get the current tab document", but Mozilla changed all of its links without maintaining backward compatibility and thus breaking a lot of linked sites.
Correct url: https://developer.mozilla.org/en/Extension_Code_Snippets/Tabbed_Browser#Getting_document_of_currently_selected_tab
This document explains how to get the document object the way you would expect to get in the Javascript web interface.
Given that you can easily request gBrowser.contentDocument.location.href
or content.document.location.href
. If your use case is more complex than a script running in an active tab (for example, your script is running in a XUL popup), then your best bet is to read the FAQ.
source to share