Search
 
SCRIPT & CODE EXAMPLE
 

HTML

how to set a var in js to be a download

var textToSave = 'this is a test';

var hiddenElement = document.createElement('a');

hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.txt';
hiddenElement.click();
Comment

PREVIOUS NEXT
Code Example
Html :: google maps css 
Html :: a complete website with bootstrap 5 
Html :: Change iframe src by clicking a link 
Html :: muted not working in video tag angular 
Html :: html2pdf pagebreak option 
Html :: bootstrap form input select 
Html :: using local image in html meta tag 
Html :: html italic 
Html :: how to change colour of part of a text in html 
Html :: bootstrap wysiwyg 
Html :: html code tag 
Html :: click on tr redirect new page 
Html :: how to make a list in html 
Html :: remove padding in code 
Html :: python timestanp 
Html :: country select in bootstrap form 
Html :: fork me github code 
Html :: how to change language to django-html on vscode 
Html :: phone number validation html 
Html :: can se have same id for radio button in html 
Html :: html syntax 
Html :: HTML <mark Element 
Html :: what is the PERN stack 
Html :: pdf download button 
Html :: fieldset margin 
Html :: HTML-Whatsapp Spammer 
Html :: telerik export to excel with leading zero 
Html :: Links do not have a discernible name 
Html :: capture image 
Html :: pyscript 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =