Reputation: 822
When I open a new tab it first flashes white then puts up my page. I'd like to not have the flash. I was thinking I could load the tab in the background then switch to that tab once it was fully loaded (so no white flash).
I use inBackground: true to create the tab and load it (but not switch to it yet). But now once I have done this how can I programmatically switch to it?
If there is a way to open a tab directly but first wait until it is rendered so it does not flash that would be great too. But tabs.open does not seem to do that.
The bellow code is modified from https://developer.mozilla.org/en-US/Add-ons/SDK/Tutorials/Getting_Started_(jpm)
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
var button = buttons.ActionButton({
id: "mozilla-link",
label: "Visit Mozilla",
icon: {
"16": "./icon-16.png",
"32": "./icon-32.png",
"64": "./icon-64.png"
},
onClick: handleClick
});
function handleClick(state) {
tabs.open({ url: "http://localhost/HomePage/", inBackground: true });
}
Upvotes: 1
Views: 60