When opening a new tab with a new tab replacement add-in, how to keep the address bar transparent?

I am developing a new tab note add-on for Firefox. After installing it, when I click the new tab icon to open a new tab, the new tab opens normally, but the messy URL is displayed in the address bar: resource: // firefox_p-at-getblog-dot-com / getblog_buttons_page / data / newtab .html

How to make the address bar empty?

+4
source share
3 answers

There are only a few pages that will have an "empty" uris in the URI panel.

You now have several options:

  • / browser.xul URI gInitialPages about gInitialPages.
  • , @canuckistani, . URI, .;)
  • , , override about:newTab. (?) , , , about:newTab, , /.
+2

webNavigation/docShell , setCurrentURI. , . , .

gBrowser.webNavigation.setCurrentURI(Services.io.newURI('about:blank', null, null))

about:blank, URL, , URL.

DOMContentLoaded , . , , , , .

, URL- about:newtab, , - , , about:ANYTHING, ur IF ANYTHING url, : newtab, about: about the blanks it. , , - , , .

+1

You probably want to replace this with your own custom: protocol - here are the soem docs on how to do this:

https://developer.mozilla.org/en-US/docs/Custom_about:_URLs

Here is an example of the real world in a rather complex SDK addon: https://github.com/mixedpuppy/about-awards/blob/master/lib/main.js#L171-L192

0
source

Source: https://habr.com/ru/post/1540628/


All Articles