PDA

View Full Version : Specifying a MIME type when opening a window



bennym
11-26-2003, 11:34 AM
I want to open a file in a new browser window, in HTML (window.open). But because the file's extension is unknown to the browser, I get the 'specify application to use' dialog, wheras I know the file contains plain text and want it to open in a new browser window. Is there some way I can specify that the file should be treated as a text file (short of changing its extension)?

Thanks.

mysticlighthouse
11-26-2003, 02:30 PM
try this... let's say that your site is http://www.foo.com and the file you want to display is blah.slp

in your window.open for the url use:

view-source:http://www.foo.com/blah.slp

that should work for you.

You're just wanting to have the browser look at the text file right?

If you want it to render as html then you should just be able to use http://www.foo.com/blah.slp in your window.open

httpman
11-26-2003, 11:27 PM
Bennym,

Are you using a Linux / Apache platform ?

If yes, you can specify tons of rules via a specific file called ".htaccess". Look there : http://wsabstract.com/howto/htaccess.shtml

You can specify which page to load when a user ask for a non-existing page (those pages which usually generate a "404 file not found" error), or - best suited in your case : which application should be launched which any file extension... Or also : which part of the site should be password protected. And so much more.

So many things which are available for free !! Enjoy.

JP

bennym
11-27-2003, 04:04 AM
Thanks guys - the view-source solution did the trick, alhtough that .htaccess info will be invaluable for another project I'm starting on.

Thanks again,
B