12

Determining whether your extension is running in FireFox or Thunderbird

 3 years ago
source link: http://www.mikechambers.com/blog/2004/12/09/determining-whether-your-extension-is-running-in-firefox-or-thunderbird/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Determining whether your extension is running in FireFox or Thunderbird

Thursday, December 9, 2004

One of the things that is cool about building extensions for FireFox, is that in most cases they can easily made to run within Thunderbird. However, sometimes your extension needs to know which environment it is running within. You can determine this by checking the navigator.vendor property.

var firefox = false;
var thunderbird = false;

var vendor = navigator.vendor;

if(vendor == "FireFox")
{
    firefox = true;
}
else if(vendor == "Thunderbird")
{
    thunderbird = true;
}

dump("Running in FireFox : " + firefox + "\n");
dump("Running in Thunderbird : " + thunderbird + "\n");

This makes it easy to branch your code when necessary.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK