Download File Using Javascript/jQuery

前端 未结 28 2937
悲&欢浪女
悲&欢浪女 2020-11-21 05:11

I have a very similar requirement specified here.

I need to have the user\'s browser start a download manually when $(\'a#someID\').click();

But

28条回答
  •  醉梦人生
    2020-11-21 05:54

    Works on Chrome, Firefox and IE8 and above.

    var link=document.createElement('a');
    document.body.appendChild(link);
    link.href=url ;
    link.click();
    

提交回复
热议问题