Make Firefox Addon tab feels like chrome://newtab

483 Views Asked by At

I'm working on some chrome/firefox extension and what I want to accomplish is as similar UX as possible between these two. I've already understood that while in chrome you can (through manifest.json) register to override chrome://newtab, in firefox it's not such an easy job. What I want to accomplish in firefox is that once user click on browser action button - it opens new tab with my local HTML page. This codes do just that:

var buttons = require('sdk/ui/button/action');
var tabs = require('sdk/tabs');
var wuntils = require('sdk/window/utils');

var handleClick = function (state) {
    tabs.open({
        "url": "./pages/index.html",
        "isPinned": false
    });
};

var button = buttons.ActionButton({
    id: "mozilla-link",
    label: "Visit Mozilla",
    icon: {
        "16": "./assets/logo.png",
        "32": "./assets/logo.png",
        "64": "./assets/logo.png"
    },
    onClick: handleClick
});

Problem with this approach is that once new tab is opened theres resource://.... URL in the address bar. I've noticed that some other extensions managed to remove it and keep address bar empty but if I try to change tab.url property it starts redirection loop...

Any ideas how to make it look like a new tab but keep address bar empty?

Thanks!

0

There are 0 best solutions below