Opening a browser window in Thunderbird Extension

I'm currently working with a Thunderbird Add On which opens a pop-up every time someone hovers over a link. In this pop-up, the user should be able to click on a link which opens a new window or tab in a browser (one that the user set default).

var win = **window.open**("www.google.com", "_blank", "chrome,centerscreen");

Is what I tried for this, but this just opens a Thunderbird window with no address bar or anything like that, and the content in this window doesn't do anything if I click on it.

I also tried:

var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
               .getService(Components.interfaces.nsIWindowWatcher);

var win = ww.**openWindow**(null, "www.google.com", "_blank", "chrome,dialog=no,all,centerscreen", null);

but this seems to work just the same as above.

Answers:

Answer

Even i was having the similar requirement and facing the same issue and trying to figure out the right way to do it. Following options failed:

  • Window.open
  • Window.location -> location.assign()
  • Components.classes mentioned in your question

After going through many many Thunderbird addon related web pages, following workaround from this page worked for me:

messenger.launchExternalURL(url);

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.