ie8 window.open xls does not work
I have a simple html page to open a different HTML based on a OPTION list using an ON CHANGE to fire the WINDOW.OPEN, In IE8, I get a window appear and disappear real fast when I select May10. when I select SFAA or google, it works fine and opening the xls file using A HREF works fine too.
I try this in Firefox(3.6.13), chrome and everything works fine.
`<select name="target"
onChange="if (this.options[this.selectedIndex].value != '')
{window.open(this.options[this.selectedIndex].value,'_blank');};" >
<option VALUE="" style="color:#000000;">Select</option>
<option VALUE="http://www.google.com">google</option>
<option VALUE="../May10.xls">May 10</option>
<option value="../sfaa.pdf">SFAA</option>
</select>`
window.open(this.options[this.selectedIndex].value,'_blank'); does not work in IE8. '_parent' or '_self' works in IE8 too. everything works fi开发者_开发问答ne in Firefox and google chrome
I came across a solution on web, replace js call
window.open(this.options[this.selectedIndex].value,'_blank');
with
var w = window.open(this.options[this.selectedIndex].value,'_blank');w.location.href = this.options[this.selectedIndex].value;
It woks fine in both IE8 and firefox.
Can you maybe post a screenshot or description of the window or info message that appears?
...cause it works fine for me when I tried on IE8/Windows 7/MBP.
What I did is I made an html file of your code you posted and when I selected my own xls file (saved in Excel 2007) in IE8, it prompted me with the dialog to open/save/cancel the file (like when you download an attachment) and I can select to view it, and the document opens up successfully.
Maybe also check the relative path you've supplied whether it is right that the named file exists and is not corrupted and your computer is programmed to run xls files with Excel by default?
What headers do you see on the HTTP response for the XLS file (e.g. look in Fiddler)?
If it cannot be downloaded (e.g. due to no-cache headers) then you might see bad behavior like this.
http://blogs.msdn.com/b/ieinternals/archive/2009/10/03/internet-explorer-cannot-download-over-https-when-no-cache.aspx
精彩评论