Creating download prompt using purely javascript

前端 未结 4 1393
梦谈多话
梦谈多话 2020-12-21 12:21

I have some text data (say var a = \'Hello World From Javascript\';)in javascript variable in current window. I want to do the following through javascript-

4条回答
  •  醉酒成梦
    2020-12-21 13:00

    If you already have the file on the server (I make an ajax call to generate and save a PDF on the server) - you can do this

    window.location.replace(fileUrl);
    

提交回复
热议问题