operaopera-extension

Why in Opera the 'chrome_url_overrides' is not allowed for specified extension ID?


I am making a cross-browser extension, which overrides the standard "New Tab" page.

There is a manifest.json key for that, called chrome_url_overrides:

"chrome_url_overrides": { "newtab": "index.html" }

It works in Chrome and Firefox! But in Opera (45.0) the following error occurs when I try to load the extension:

'chrome_url_overrides' is not allowed for specified extension ID.

Based on what I've read in the MDN chrome_url_overrides docs, Opera supports that.

Now I'm not sure if Opera doesn't allow that in general, or if there is a way to activate it?


Edit: I found a similar, unanswered yet, 3-months-old thread in the Opera Forums.


Solution

  • Actually Opera now officially does not support chrome_url_overrides. A piece of evidence can be found on the MDN page that you referenced and it was confirmed by an Opera representative in their forum.

    A potential workaround for achieving a new tab extension in Opera (actually this should work in other browsers too) is to use a background script with the following code:

    const redirectURLS = [
      "opera://startpage/",
      "browser://startpage/",
      "chrome://startpage/"
    ];
    
    chrome.tabs.onCreated.addListener(function(tab) {
      for (let i = 0; i < redirectURLS.length; i++) {
        if (tab.url === redirectURLS[i]) break; // user is trying to open startpage
        if (i == redirectURLS.length - 1) return; // Tab is not trying to open a startpage
      }
      chrome.tabs.update(tab.id, { url: "index.html" });
    });
    

    Having this will check if the user tries to open a new tab and if this is the case it will open the custom index.html page that came with installing the plugin instead. It's a hacky and dirty and not sure if it's going to be accepted by Opera but still, this may be a path of salvation for someone desperately trying to get a new tab extension live among the other Opera Addons.

    Fun fact: Opera developed and distributed an addon which helps you install chrome extension from chrome extension store on Opera but the new tab extensions don't work and fail upon installation with the following message:

    [Compatibility notice] Please, be aware that this extension requires APIs that are not supported in Opera. It still can work in Opera, so complete installation to verify.