<html> <head> <script type="text/javascript"> window.master = ({ newtab: function(url, callback) { callback = callback === true ? (function() { this.close(); }) : callback; try { chrome.tabs.create({ url: url }); if(typeof callback === "function") { callback.call(this, url); } } catch(e) { } }, link: function(event, close) { event = event ? event : window.event; event.preventDefault(); this.newtab(event.href, close); }, close: function() { window.self.close(); } }); </script> </head> <body> </body> </html>
If you insist on using a popup and want it to close as soon as it is open, use the above. Just add the link bar and true boolean to the master.newtab function master.newtab that it opens a new tab and then closes the popup.
If you change your mind about closing the popup, you can replace true boolean with a function to execute if a new tab was created without any errors. You can also use the master.link function to call the master.newtab function from the binding element.
The best thing about using Chrome Extensions is that you never have to worry about support issues !: D
source share