I cannot access urlbar in firefox addon
I can't access the urlbar object as a firefox add-on in any way, if I add it to permissions in the manifest.json firefox tells me "Invalid extension permission: urlbar", but if I request "tab" as permission, it shows me as property:
Reading manifest: Warning processing permissions: Error processing permissions.1: Value "tab" must either: must either [must either [be one of [
"clipboardRead",
"clipboardWrite",
"geolocation",
"idle",
"notifications"
],
/********* A LOTS OF PERMISSIONS ************/
be one of [
"urlbar" // <<< RIGHT HERE!!!
], be one of [
"contextualIdentities"
], be one of [
"dns"
],
/********* A LOTS OF PERMISSIONS ************/
be one of [
"theme"
], or match the pattern /^experiments(\.\w+)+$/
], or must either [be one of [
"<all_urls>"
], must either [match the pattern /^(https?|wss?|file|ftp|\*):\/\/(\*|\*\.[^*/
]+|[^*/
]+)\/.*$/, or match the pattern /^file:\/\/\/.*$/
], or match the pattern /^resource:\/\/(\*|\*\.[^*/
]+|[^*/
]+)\/.*$|^about:/
]
How do I access the urlbar? My intention is that after making a redirection of a fantasy url (like http://something.server.internal) redirect to another page (which I already do) but not change the url in the address bar. As an alternative I have thought of loading an iframe with the content of the page to be redirected but I cannot control the content of the page that does not exist.
The URL bar is not accessible WebExtensions addons. Instead there is the omnibox
API: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/omnibox
But you don't need to use omnibox
for redirections. Instead listeners for webRequest.onBeforeRequest
can do that. See also:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onBeforeRequest#Examples