Is there a way I could download the current document's innerHTML
as file programmatically?
I've made the following attempt without success. It does download the current document's source, however that's not what I am looking for, since I want to preserve any post-load document modifications.
var save = document.createElement('a');
save.href = "my location href.attr";
save.target = '_blank';
save.download = fileName || 'unknown';
var event = document.createEvent('Event');
event.initEvent('click', true, true);
save.dispatchEvent(event);