google chrome download current page code example
Example 1: chrome extension get current tab url
chrome.tabs.query({currentWindow: true, active: true}, function(tabs){
console.log(tabs[0].url);
});
Example 2: javascript download current html page
// 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();