“Pobierz JavaScript Pobierz bieżącą stronę HTML” Kod odpowiedzi

Pobierz JavaScript Pobierz bieżącą stronę HTML

// in the current page, download the html source
var hiddenElement = document.createElement('a');
hiddenElement.href = 'data:attachment/text,' + encodeURI(document.documentElement.outerHTML);
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.txt';
hiddenElement.click();
Doubtful Deer

Jak ustawić var ​​in JS na pobieranie

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();
Lazy Lion

Odpowiedzi podobne do “Pobierz JavaScript Pobierz bieżącą stronę HTML”

Pytania podobne do “Pobierz JavaScript Pobierz bieżącą stronę HTML”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu