Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js download json

function download(filename, json){
    const element = document.createElement('a');
    element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(JSON.stringify(json)));
    element.setAttribute('download', filename);

    element.style.display = 'none';
    document.body.appendChild(element);

    element.click();

    document.body.removeChild(element);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: firebase authentication logout 
Javascript :: jest test array of objects 
Javascript :: nodemail self signed certificate in certificate chain 
Javascript :: alphabetical order array javascript 
Javascript :: js get url params 
Javascript :: jquery scroll to element 
Javascript :: once page loaded run function 
Javascript :: adonis js sort by 
Javascript :: $ is not defined 
Javascript :: import angular flex layout 
Javascript :: javascript delete cookie 
Javascript :: document ready without jquery 
Javascript :: enzyme check state 
Javascript :: jquery cast to string 
Javascript :: javascript reserved words 
Javascript :: js parse url decode 
Javascript :: javascript style text decoration 
Javascript :: javascript screen width 
Javascript :: end code nodejs 
Javascript :: javascript create text file 
Javascript :: .on change get value 
Javascript :: angular ng build Maximum call stack size exceeded 
Javascript :: get method 
Javascript :: jquery selected option 
Javascript :: how to get id of parent element in jquery 
Javascript :: jquery radio button checked event 
Javascript :: switch browser to fullscreen 
Javascript :: flutter keep local storage even after is closed 
Javascript :: get channel id discord js v12 
Javascript :: how to edit the link in a href with jquery 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =