Search code examples
asp.nethtmlasp.net-controls

<a href> tag to open excel file


I am currently using Visual Studio 2010 and wanted to have a link on my page that opened in a new window a simple excel sheet that is on a local drive.

I have used a simple tag to open this file.

  <a href="S:/BettyTest.xlsx" target="_blank" title="Excel Test">Excel Book Test</a>

This opens the file as requested but it doesn't open this to a new window. I am currently using IE8. When clicking the link, I get the prompt to either open or save the workbook and when I select open, this opens over the web page.


Solution

  • Your href needs to be different

    Something like this

    file:///S:/BettyTest.xlsx