Adding the XPI MIME Type for Firefox Extension Installs

By  on  

Yesterday I posted version 0.1 of the David Walsh Blog Toolbar for Firefox. Unfortunately that led to an awkward conversation with my .htaccess file.

.htaccess: I have no idea what to do with this.
me: I want the toolbar to install when they request this file.
.htaccess: Well, how am I supposed to do that?
me: OMG! You don't know?!
.htaccess: No, just like you didn't know how to create a Firefox extension before you did the research.
me: Good point. When can you research and start serving it up?
.htaccess: I can't research. I'm a file.
me: Oh. So I just need to figure things out for you again?
.htaccess: You never pay attention to me anymore...

That went on for quite a while but the moral of the story is that if you want your server to handle XPI files correctly, you need to add the following to your .htaccess file:

AddType application/x-xpinstall .xpi

If you don't add the above directive, Firefox will open the file as plain text which is an ugly mess.

Recent Features

  • By
    Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() - this is the hook that allows Javascript code to synchronize with a web browser's native paint loop. Animations using this method can run at 60 fps and deliver fantastic...

  • By
    Create a CSS Cube

    CSS cubes really showcase what CSS has become over the years, evolving from simple color and dimension directives to a language capable of creating deep, creative visuals.  Add animation and you've got something really neat.  Unfortunately each CSS cube tutorial I've read is a bit...

Incredible Demos

  • By
    MooTools CountDown Plugin

    There are numerous websites around the internet, RapidShare for example, that make you wait an allotted amount of time before presenting you with your reward. Using MooTools, I've created a CountDown plugin that allows you to easily implement a similar system. The MooTools JavaScript The CountDown class...

  • By
    The Simple Intro to SVG Animation

    This article serves as a first step toward mastering SVG element animation. Included within are links to key resources for diving deeper, so bookmark this page and refer back to it throughout your journey toward SVG mastery. An SVG element is a special type of DOM element...

Discussion

  1. Only a web dev could have some kind of decent conversation with a file!

    I did wonder why it didn’t install when I clicked it, good to see you found out why though. The ever brilliant David saves the day!

  2. Awesome :)

    Is it just me or are .htaccess files getting increasingly uppity lately?

  3. You’re hilarious, dude! Have fun in Cali!!

  4. Facundo

    LOL! i used to have long talks whit .htaccess too.

  5. I envy your relationship with your .htaccess file.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!