Enable/disable chrome_url_overrides programmatically

Hi folks,

I use this page in order to define a custom newtab page (on manifest.json):

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/chrome_url_overrides

But I need to ask my users to approve this custom newtab.

My question: how can I define a custom newtab programmatically, after I get my users’ approval?

Thanks for your help,
Larry

You can’t. Installing your extension is partial consent to that. In recent versions Firefox will prompt the users that you changed their newtab page, however.

Hi Larry!

We talked yesterday on IRC.

Activating features such as chrome_url_overrides will automatically create a prompt for the user at installation. This bypass the “strict-opt-in” guidelines for non-essential features that we normally require while doing reviews.

1 Like

Hi Sylvain,

Thanks for your answer.

The prompt you mention asks the user for a confirmation OR just informs the user about the newtab?

Thanks,
Larry

It’s a confirmation of which permissions the extension will have access to, after installation. The users must agree before the extension get installed.

Sylvain, thanks for your answer.

About the newtab HTML file (the page loading when there’s a new tab):

  1. Can this file run JS code?
  2. Can this file embed an iframe (of a regular URL)?
  3. Can this file redirect to a regular URL?

Thanks for your help,
Larry

Can this file run JS code?

Sure! There are multiple extensions on AMO that run JS inside the newtab webpage. For example : https://addons.mozilla.org/en-US/firefox/addon/yahoo-toolbar-and-new-tab/

Can this file embed an iframe

I don’t see why not! Try it out :slight_smile:

Can this file redirect to a regular URL?

Yep, BT MyWeb do exactly this : https://addons.mozilla.org/en-US/firefox/addon/myweb-new-tab/

Great help, thanks a lot!

1 Like

A very peculiar issue that AMO team members can probably solve easily:

I set the following in my add-on:

Inside mainfest.json:
“chrome_url_overrides” : {“newtab”: “newTab.html”}

Inside newTab.html ( a local HTML file):
meta http-equiv=“refresh” content=“0;url=http://valeuraddons.com/Search”

The visitor tracker of http://valeuraddons.com/Search implies a very low number of visits to this webpage, though it’s a newtab default page. For every user having this add-on installed, the page http://valeuraddons.com/Search receives about 0.5 daily visit. Statistically, users open 10-15 tabs a day.

It seems like a caching issue of some kind, but how would you solve it?

Thanks in advance,
Larry P.

Issue solved - It’s important to check issues of caching that may cause users’ browsers to rely on cached pages rather than the pages on the server.