[Project_owners] web server MIME-types for XPI?

Michael Vincent van Rantwijk mv_van_rantwijk at SPAMFREEyahoo.com
Mon Jun 27 14:17:25 EDT 2005


Didier Ernotte wrote:
> The server should set up the mime type to "application/x-xpinstall". If
> it's an apache server, maybe the mine.type file does not contain a line
> for xpi file. 

> I have the same problem with my remote server. I have
> tried to put "  type='application/x-xpinstall' " in the href of the
> link , be it seems that the default mime type of the server has a
> higher priority than my html setting. You can also use a firefox-only
> javascript method to load it (I don't remember its name, something like
> InstallPackage...), but it's not cross-plateform.
> 
> Didier 

Can you use PHP on that server? If yes, this should work:

install.php

<?php

$completeFilePath = substr($_SERVER['PATH_INFO'], 1);

if ( stristr($completeFilePath, 'tp://') ) {
   $fileName = basename($completeFilePath);

   header('Cache-Control: no-cache, must-revalidate');
   header('Pragma: no-cache');
   header("Content-type: application/x-xpinstall\nContent-Disposition: 
inline; filename=\"".$fileName."\"");

   $fd=fopen($completeFilePath,'r');
   fpassthru($fd);
} else {
   header('Location: /');
}

?>

Initiate the install with:
http://foo.bar.com/install.php/http://foo.bar.com/myxpi.xpi
from you (X)HTML source.

Michael


More information about the Project_owners mailing list