I have a problem with the click()
-function from jquery. I create a <a>
-element with document.createElement('a')
and want call the click()
-function about this element. About this element, I want to create an Excel-file and save this at the desktop.
My code:
$('body').on('click', '#test', function(event) {
var link = document.createElement('a');
link.download = 'test.xls';
link.href = 'data:application/vnd.ms-excel;utf-8,test';
link.click();
});
This function work under chrome, but not under Firefox.
Working example
Does anyone have any idea why that does not work?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…