Wednesday, January 03, 2007

Gadgets download

Yesturday, I noticed about interesting problem - how to make download gadget. Seemed stupid? No. Try to upload your gadget to any web server (it might be even apache). While you'll try to download it you'll get following in IE and FF. What's the hell? Why it's ZIP??? I uploaded .Gadget!

 

You see .ZIP extention just because .Gadget is really .ZIP, so "smart" IE knows to "translate" extention in order to prevent fraud. Very nice, but I want do download and install gadget. As like as I can do in in http://gallery.live.com

How to configure my server to do it. Simple answer is right MIME type. It's application and it's zipped, so we can use  application/octet-stream, application/x-compressed or even application/x-msdownload. Let's try. Just register .gadget type with one of those. In first case you'll get octet stream :) Obviously. And this looks like that

Bad one. The next x-compressed will return us to previouse state with .ZIP renaming. Let's see what will be with x-msdownload.

You able to download gadget as requested, but you can not install it (Open->Run) from the web (like in Live.Gallery)

So such thing is not suitable for us. After some digs of my friends from Redmond (from Live team - they are only 3 :) ) I found it. The right MIME type for Vista SideBar Gadget is application/x-windows-gadget. Register .gadget extention with application/x-windows-gadget MIME type and you'll able to provide your visitors Live.Gallery like installation option for gadgets

Yossi, do it here for us as well :)

Have a nice gadget :)

No comments: