Get the current document address (Firefox extension)

Does anyone know how to get the URI of the current page / tab?


source to share

3 answers


contains the URI of the Windows document.



This page seems to have what you are looking for

and this one may have more information you will find useful



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:

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.



All Articles