Oh right you want to override a MIME type saved in a browser. You can't do that in Javascript, but you apparently can in PHP.
Here's an example.
http://forums.dreamincode.net/showtopic9446.htm
Follow that, and use the code I wrote above to open the .php file you create.