On the table there is a table when clicking on the button, it should be downloaded to the excel file.

Found this way:

$('table.views-table.cols-7').click(function() { var url = 'data:application/vnd.ms-excel.xls,' + encodeURIComponent($('table.views-table.cols-7').html()) location.href = url return false }) 

click put on itself (not fundamentally), but a simple file is downloaded, not without any extension

what attributes can this file have and how to set them, well, the same name for example. Is there any article?

1 answer 1

The file must be formed on the server and not on the client, and then download it. With js client do not.

  • one
    Not quite, unexpectedly possible. With the help of the data protocol, you can unload at least a real xsl or xslx file (they are difficult to form in js, but you can :)). The problem remains - to create a file. There are two simple methods xml + html, or xml + excel (his own). One drawback - getting the file via the data protocol does not work for some browsers, in particular, ie. Works for Opera Fox Chrome. - nick_n_a
  • Is not it easier to upload on the server and download? - heff