I'm writing a sidebar extension for Firefox and need a way to get the URL of the current page so I can check it against a database and display the results. How can I do this?
If you want to get current URL in current Firefox extension, just add content script (developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/…) and ask directly for document. location from it.
You can add Sidebery to Firefox by clicking the Add to Firefox option. Then, you'll see a Toggle Sidebery sidebar button on Firefox's URL toolbar. Click that button to view the vertical tab sidebar. Sidebery displays your open page tabs within the default panel.
I stumbled over this post while looking for an answer to the same question.
Actually I think it's as easy as
alert(window.content.location.href)
See also https://developer.mozilla.org/en/DOM/window.content
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With