Skip to content

Instantly share code, notes, and snippets.

@o0101
Created November 1, 2017 15:35
Show Gist options
  • Save o0101/7229028782f1f5da2f68d8ec9055c592 to your computer and use it in GitHub Desktop.
Save o0101/7229028782f1f5da2f68d8ec9055c592 to your computer and use it in GitHub Desktop.
download page html
"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