How do I link to odt/docx files in a webpage?
Hey I am trying to link to an odt (Open Document Text) file Internet Explorer always seem to want to open them in a zip program. I understand that a odt (and docx I have this problem with also) are infact ZIP files - but I want to be able to link to them in the same way I can a PDF or DOC for users to choose what doument format they want do download (PDF,DOC,DOCX,ODT).
If anyone knows of any kind of extra I can put in the tag, or some php or something I can use to make these download like normal files, and not ZIP files. I think it is rather amusing that Firefox (and Opera) understands a DOCX is a Word file and asks to open it in Word, and yet IE programed by the same company wants to open it in WinZip! TIA Matt. |
Well, IE isn't something behind the word "best out there".
Good though that you care about it, I know many web site creators who would just have let the problem be as it is, "it's their fault if they use such a bad browser". I thought there was a way to "force" downloading a file rather than opening it directly but as you are wrestling with that problem, I guess not..sorry for not being able to help atm. |
The server may be sending a MIME type that makes IE think it is a ZIP file. Try having PHP send the MIME type of application/vnd.oasis.opendocument.text or application/msword
As a hack to get around the problem, I have seen sites that say "right click and save as"... but that is not the ideal solution. I don't use Windows, so I can not test by theory. |
Add an association for that mimetype. Even better would be to not use Internet Explorer. It's even the recommendation of the dept of Homeland Security.
|
I don't use windows.... I use Firefox for most of my stuff, IE or Opera for other things... but there are of course 70% or more people that use Windows and IE so I have to look after them especially concidering I am trying to get as many people as possible to read and print and sign this document. I don't look after the server or the PHP installation as I am hosting files on a Uni web server for someone else - but I will speak to the tech guys at the Uni to get it sorted out.
This is what I thought (that PHP reads the file and see's it is a ZIP file and sends that MIME - or something to that effect). Thanks everyone. Matt. |
In PHP, you can change the headers in order to tell the browser the file type:
PHP Code:
Doing this does increase the server load slightly. It is better if the Apache configuration is updated (actually the MIME magic file on the system) to a version that can identify open document files without all this code. |
All times are GMT -5. The time now is 12:33 AM. |