mozdev.org

Developer Notes   

Improved Installation Script

I wrote all day on an improved installation script for xpi packages, so I'll share the result with you.

If you want to offer Mozilla add-ons from your website in a user-friendly way, you may want to offer 2 options:

I took the script from the iPlanet PSM installation page, stole a few ideas from other sites (I hope, they don't object), improved that and added several functions of my own.

Basic features (startInstall):

Advanced features (genLaunch):

Usage of the "Advanced features" is optional. Use |genLaunch|, if you want to provide an additional, direct download link on the page and |startInstall| otherwise.

Using |startInstall(xpi, exclusive)|

This mode is similar to the scripts commonly used at the moment. You have to populate an array with the URIs and names of the to-be-installed packages, the format is the same as for InstallTrigger itself. The second parameter specifies the strictness of the browser check:

// for exclusive
const anymozilla = 0; // any Mozilla
const sameversion = 1; // this Mozilla release only,
e.g. Mozilla 0.6/Netscape 6.0/Beonex Comm. 0.6
const samevendorrelease = 2; // this vendor release only, e.g. Beonex Comm. 0.6

You have to modify the script, if you want to detect another release (see todo below).

The functions isWindows(), isLinux() and isMac() may help you with determining the correct URIs, badPlatform() with handling platforms you don't support.

An example page is attached.

Using |genLaunch(idClass, exclusive)|

This is a very specialized function which does most of the above automatically.

It does this by looking at the page from which is has been invoked and searching for specifically marked URIs, with which it will populate the packages array.

The URIs for the XPIs have to be in a href of an tag.

The name attribute of the tag will be used for the package name (shown in the installation confirmation dialog).

The class of the tag *has* to include one of the following strings: "dlWin32", "dlLinux", "dlMac", "dlAll". If the package is for Win32 only, you have to use "dlWin32". If the package is platform-independant, use "dlAll".

If there are different packages on the same page (e.g. PSM and Spellchecker), you can also add an additional class for the package, e.g. "psm". You can then specify the same string as |idClass| parameter for |genLaunch|, and it will select only those packages that have this class. If there is only one type of package at the page or you want to install all packages at once, just pass an empty string as |idClass parameter.

The second parameter for |genLaunch| is like that for |startInstall|. Examples attached:

You can see them live at
(http://www.beonex.com/communicator/version/0.6/add-ons/security/jsj.html), (http://www.beonex.com/communicator/version/0.6/add-ons/binaries/java) and (http://www.beonex.com/communicator/version/0.6/add-ons/l10n).

Note: The examples don't work for me locally - they don't draw in the external script. But they do work on www.beonex.com.

Todo:

If you make good enhancements to the script, please post them too, so we can all take advantage of them.

Happy hacking

Ben Bucksch
Beonex

User Notes: [?]

If you do not get a response to a question posted in this forum, please try sending a message to the project's mailing list or to the project owner directly.

[1] Submitted by: Ben Bucksch on Tuesday February 27th 2001

Updated the script to check for Software Installation being enabled in the browser. Get it at <http://smserver.home.local/beonex/com/communicator/version/0.6/add-ons/install.js>.

[2] Submitted by: Ben Bucksch on Tuesday February 27th 2001

Ops, I meant <http://www.beonex.com/communicator/version/0.6/add-ons/install.js>.

[3] Submitted by: Ben Bucksch on Tuesday February 27th 2001

And a bug in mozdev.org... *sigh*. Try this one: http://www.beonex.com/communicator/version/0.6/add-ons/install.js .

[4] Submitted by: dirk on Friday January 3rd 2003

great work! - dl /

[5] Submitted by: Marius on Sunday February 2nd 2003

good idea!

marius -

[6] Submitted by: Diseño on Monday March 17th 2003

Hi from Spain!!

[7] Submitted by: buscadores on Friday March 21st 2003

thanks for the link Ben

[8] Submitted by: jonh on Friday April 11th 2003

you'r welcome!!

[9] Submitted by: Diseño web on Friday April 18th 2003

This is a very nice site, pleasant layout and design. My compliments to your designer.

[10] Submitted by: Paul on Friday April 18th 2003

Thanks you for the web, it is what I needed to complete my work.
You do a very good work and you must feel proud of it.

[12] Submitted by: complejo on Thursday May 8th 2003

good site

[13] Submitted by: motilla on Thursday May 8th 2003

hi from spain

[14] Submitted by: adwod on Thursday May 8th 2003

congratulations your site is very good

[15] Submitted by: Alex on Monday May 12th 2003

mozdev.org is a great site ;-)

[16] Submitted by: shilmar on Monday June 30th 2003

great work!

[17] Submitted by: Pierre on Wednesday July 16th 2003

Yep, great work.
http://members.lycos.nl/pierre141/tz_096/

[18] Submitted by: Diseño web on Friday August 1st 2003

Congratulations for your site

Hector gomis diseño web

[19] Submitted by: james on Saturday August 2nd 2003

Very, very funny.

[20] Submitted by: john on Monday August 11th 2003

I'd like to thank you on behalf of all of the people who expects Mozilla to keep being developed.
/

[21] Submitted by: Kalle on Wednesday August 20th 2003

A great project. Thanks.

Greetings Kalle

[22] Submitted by: Alex on Sunday August 31st 2003

Nice project!

[23] Submitted by: Gloryhole on Tuesday September 2nd 2003

Very nice project.

Gloryhole

[24] Submitted by: domenico on Thursday September 4th 2003

nice project

/comex
/hechoamano
consultoria
artesanias

[25] Submitted by: carlos on Thursday September 4th 2003

Congrats for the work


/host
diseño web hosting

[26] Submitted by: David on Thursday September 4th 2003

Great Help


-----

[28] Submitted by: Thalea on Friday September 5th 2003

Hi, I like the contents of your site,
enjoying to surf within your site.
til then

[29] Submitted by: Sam on Friday September 5th 2003

Hi, thanks a lot for this site...
Go on like this and enjoy !

[31] Submitted by: Diseño web on Monday September 8th 2003

great site!

/

[32] Submitted by: Mary on Tuesday September 9th 2003

Just surfed in to look around.
Gratulation to this really nice site!

[33] Submitted by: Jose on Thursday September 11th 2003

Thanks

[34] Submitted by: JB on Monday September 15th 2003

Very interesting information.
/

[35] Submitted by: Martha on Wednesday September 17th 2003

Hello, I just wanted to say you have a very informative site which really made me think, Thanks !

[36] Submitted by: Manuel on Wednesday September 17th 2003

I just surfed in and found your site, I really enjoyed the visit and hope to come back soon. nice Site!

[37] Submitted by: Urbe on Wednesday September 17th 2003

Thank you for the wonderful website and information I will be back soon. Greetings

[38] Submitted by: Abel on Wednesday September 17th 2003

Congratulations for your site!

[39] Submitted by: Educoweb on Thursday September 18th 2003

This site is interesting as well as informative. Enjoyed browsing through the site. Keep up the good work. Greetings..

[40] Submitted by: Kalle on Thursday September 18th 2003

Nice Tool. Keep it alive.

Greets Kalle

[41] Submitted by: Marco on Friday September 19th 2003

Congratulations to your fantastic Site. Thanks

[43] Submitted by: Visit my Page on Saturday September 20th 2003

/versteigerung/

[44] Submitted by: Marco on Saturday September 20th 2003

Great Site! There was some interesting Informations on this Page! Really nice! Thank you!

[45] Submitted by: Berberecho on Saturday September 20th 2003

Great Site! There was some interesting Informations on this Page! Really nice! Thank you!

[46] Submitted by: Andreas on Sunday September 21st 2003

http://www.freizeittip.de
http://www.beauty-bedarf.de
http://www.lr-zielinski.de
http://www.gesundes-abnehmen.com

A great project. Thanks.

[47] Submitted by: Florencia Sarasola on Monday September 22nd 2003

hosting uruguay
dominios uruguay
reseller hosting

paso de los toros
santa isabel
ciudad de paso de los toros

[51] Submitted by: qwrtqw on Tuesday September 23rd 2003

/ / / / /

[52] Submitted by: Visa Kreditkarte on Tuesday September 23rd 2003

www.visa-kreditkarte.de

[54] Submitted by: jims on Tuesday September 23rd 2003

Your work is very interesting.

[55] Submitted by: María on Wednesday September 24th 2003

Hello, a really interesting experience to visit your website. For sure i will come back soon. greets to all !

[56] Submitted by: A Sanchez on Friday September 26th 2003

Very useful site

[57] Submitted by: Best regards on Saturday September 27th 2003

Germany

Questions or comments not answered in the FAQ can be submitted from our feedback page.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.