简体   繁体   中英

Save Base64 String as an Excel .xls file using JavaScript in IE 7

I have been trying to find a way to save a Base64 String in IE 7 using JavaScript as a Excel .xls file. The following works fine with FireFox:

window.open ("data:application/vnd.ms-excel;base64," + bytestring, "", "width=300,height=300,resizable=1");

where bytestring is the Base64 string. This method however does not work for IE 7.

Having done some internet research, it seems that IE 7 can't seem to handle dealing with Base64 Strings. How would I be able to achieve this? Would I have to use convert Base64 to UTF to be able to do this?

What I am trying to achieve is when the user clicks a button, the 'save as' dialog appears, allowing the user to give a filename and select destination, and then saving the Excel file.

I am limited to using IE 7. Believe me, if I had a choice to use a different browser, I definitely would.

Thanks in advance for any help!

This isn't possible in IE7, without a server-side proxy. Either do that, or output an HTML table and ask the user to copy and paste it into Excel.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM