Created
November 1, 2017 15:35
-
-
Save o0101/7229028782f1f5da2f68d8ec9055c592 to your computer and use it in GitHub Desktop.
download page html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
{ | |
const page = document.documentElement.outerHTML; | |
const pageBlob = new Blob([page]); | |
const objectURL = URL.createObjectURL(pageBlob); | |
const anchor = document.createElement('a'); | |
anchor.target = "_new"; | |
anchor.setAttribute('download','page.html'); | |
anchor.href = objectURL; | |
anchor.innerText = 'download page.html'; | |
document.body.appendChild(anchor); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment