2

I have an XLS file, such as www.mysite.com/test1.xls. When clicking on the link it always brings up the spreadsheet inside Internet Explorer, with excel embedded in the browser and in a less functional version. For instance, panes and auto-filtering in the document do not work.

Can I force this to open directly in full excel, for all users, no matter their browser? Perhaps some additional tag I can put on the link?

Btw, Word documents behave the same way, but the issue is mostly with excel.

1

You'd want to create a download link

<a href="www.mysite.com/test1.xls" target="_blank">FILE</a>

When you target="_blank" you tell the browser to open a new window which should prompt the user to decide to download or open the file.

_blank  Opens the linked document in a new window or tab
_self   Opens the linked document in the same frame as it was clicked (this is default)
_parent Opens the linked document in the parent frame
_top    Opens the linked document in the full body of the window
framename   Opens the linked document in a named frame

more information

  • The target option makes it open in a new window or tab, but it is still embedded in the browser. – Uffe Kousgaard Oct 8 '14 at 13:41
  • It needs to work for everybody else but me, since I already have the file on my own harddisk. I am the one uploading it in the first place. – Uffe Kousgaard Oct 8 '14 at 16:28
  • @UffeKousgaard I understand. What I'm saying is that the browser on your machine might have a setting that automatically opens the file a specific way. Try to reset the settings on the browser to see if it prompts you on what you'd like to do – Raystafarian Oct 8 '14 at 16:30
0

If your Web Server is apache, all you need to do is add on your .htaccess config the following lines:

AddType application/octet-stream .xls
AddType application/octet-stream .doc
AddType application/octet-stream .xlsx
AddType application/octet-stream .docx

If your web server is ISS, on your web.config

<configuration>
   <system.webServer>
      <staticContent>
         <mimeMap fileExtension=".xls" mimeType="application/octet-stream" />
         <mimeMap fileExtension=".xlxs" mimeType="application/octet-stream" />
         <mimeMap fileExtension=".doc" mimeType="application/octet-stream" />
         <mimeMap fileExtension=".docx" mimeType="application/octet-stream" />
      </staticContent>
   </system.webServer>
</configuration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.