excel - can I add a mime type to a javascript encodeURIcomponent response? -


i generate excel file visible data in table have.

i generate so:

$("#data_table tbody tr").filter(":visible").each(function(i,t){         //iterate through rows , collect data                   location.href='data:application/download,' + encodeuricomponent(data);  }); 

is possible define mime-type response opened excel? solution requires browser "save as:" in order open excel.

(note: rendering not great either in csv, might skip solution altogether , go through server side).

now easy :)

i had copied code somewhere else, , while editing bit create post, started looking better @ it.

location.href containing mime type! solution is:

location.href='data:application/vnd.ms-excel,' + encodeuricomponent(data) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -