0

For a normal HTML page I tried the below code which starts download in a separate window. When I use the same code for bootstrap modal form then it's not working. What else I need to do for implement same functionality in bootstrap modal ?

 var newwin=window.open("",'newwindow','width=700,height=700, left=100,top=100,resizable=yes','_blank').document;
    var link =newwin.createElement('a');
    link.href = window.URL.createObjectURL(blob);                   
    link.download = fileName;
    link.click();
Vishal
  • 7,113
  • 6
  • 31
  • 61
DEO KUMAR DAS
  • 99
  • 2
  • 12

1 Answers1

0

you have used blob in window.URL.createObjectURL, which is undefined.

you can use this solution.

use code like this :

var newwin=window.open("",'newwindow','width=700,height=700, left=100,top=100,resizable=yes','_blank').document;
var link =newwin.createElement('a');
var blob = new Blob([json], {type: "octet/stream"});
link.href = window.URL.createObjectURL(blob);                   
link.download = fileName
window.location.assign(url);
yash
  • 2,101
  • 2
  • 23
  • 32