The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features
See the new ForumsYou need to be logged in to post in the forums. If you do not have an account, please sign up first.
Open new tab from popup
Hi Guys,I was trying to make a new tab open in a link from my extension. Using
window.open("preferences.html"); didn't cut the mustard, however after some dragonflying I came up with this:opera.extension.bgProcess.opera.extension.tabs.create(
{
url: "preferences.html",
focused: true
});
Is this seriously the only way to do it; access the bgProcess then back to the opera.extension object?! Or have I missed a much easier method somewhere?
Thanks
-Rob
Presto/2.10.289 Opera 12.00 on Windows 7 Professional 64Bit
You're not really going "back to" the same opera.extension object - they are two different objects in two different contexts and only the background script's opera.extension has the "tabs" property available.
And yes, this is the most straightforward way to achieve this.
You are also missing one thing - window.open actually works in the extension popup (just tested it), but it's subject to normal popup blocking behaviour - so by default it will be blocked if it's not preceded by a user click. Try it with F12 -> Open all pop-ups.
I think you're much better off using the method you posted. Just wrap it in a function and get on with your life
And yes, this is the most straightforward way to achieve this.
You are also missing one thing - window.open actually works in the extension popup (just tested it), but it's subject to normal popup blocking behaviour - so by default it will be blocked if it's not preceded by a user click. Try it with F12 -> Open all pop-ups.
I think you're much better off using the method you posted. Just wrap it in a function and get on with your life
Forums » Dev.Opera » Opera Extensions Development Discussions