Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening a URL in current tab/window from a Firefox Extension

I am creating a Firefox Extension...what would be the javascript to open a URL in the current tab from a menuitem?

e.g. in my overlay.xul file i have the following line:

<menuitem label="Visit homepage" oncommand="window.location='http://www.somepage.com'"/>

but in firefox, when i click on the menu item, it opens the URL but it screws up the entire layout of the browser.

What's the correct way to do this?

like image 818
aryo Avatar asked Nov 23 '08 15:11

aryo


1 Answers

After browsing around, I found that I had to replace the above code with this:

<menuitem label="Visit homepage" oncommand="content.wrappedJSObject.location='http://www.somepage.com'"/>
like image 103
aryo Avatar answered Oct 19 '22 09:10

aryo