Linked Questions
35 questions linked to/from How to get the entire document HTML as a string?
7 votes
2 answers
6k views
How to get HTML element similar to getting BODY with document.body? [duplicate]
I know there's a way to do this, but I cannot recall how. How do I go about grabbing the HTML element (top-most element in the DOM), using plain JavaScript?
0 votes
2 answers
313 views
How do I save my HTML document using SaveFile.js? [duplicate]
I'm trying to allow for a save feature on my webpage. I'm using the 'SaveFile.js' module found here: 'https://github.com/eligrey/FileSaver.js/' When a user clicks the save button, the document should ...
0 votes
1 answer
76 views
how can I get the content of a Web page as a string so I can print it somwhere else using javascript [duplicate]
var xmlhttp = null; if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp....
0 votes
0 answers
67 views
How to find text in a window? [duplicate]
Possible Duplicate: Get entire document HTML as string I want to find all instances of a regex pattern within a webpage. I want to do something like this: myWindow=window.open('http://en....
0 votes
0 answers
56 views
Get complete HTML of webpage using JavaScript [duplicate]
I would like to take a complete snapshot of website using JavaScript, like the one a browser take when saving the page as HTML (picture below). By using a simple script like document.documentElement....
40 votes
5 answers
27k views
Get DocType of an HTML as string with Javascript
I know that I can access to doctype object via document.doctype or document.childNodes[0] but my problem is getting doctype as a string. I can do this in chrome and safari by calling document.doctype ...
39 votes
5 answers
89k views
How do I get the HTML source from the page?
Is there a way to access the page HTML source code using javascript? I know that I can use document.body.innerHTML but it contains only the code inside the body. I want to get all the page source ...
10 votes
6 answers
21k views
How to download the current page as a file / attachment using Javascript?
I am aware of the hidden iFrame trick as mentioned here (http://stackoverflow.com/questions/365777/starting-file-download-with-javascript) and in other answers. I am interested in a similar problem: ...
9 votes
4 answers
20k views
Javascript: Get current page CURRENT source
I have HTML and I need to get page source of this html. document.documentElement.outerHTML or $.ajax({ async: true, type: 'GET', cache: false, url: window.location.href, success: function(data) { ...
4 votes
2 answers
8k views
how to store javascript html dom document to locastorage
I have document (component tree) 'm' which i am trying to store in the local storage of html5. I tried setting it to local storage. but when i retrieve it back, this m has changed to [object Document]....
0 votes
3 answers
8k views
How do I send an email of the current page using a button?
I am trying to send an email of my html page. This is the code I have so far: <script language="javascript"> function emailCurrentPage() { window.location.href = "mailto:?subject=" +...
4 votes
2 answers
3k views
Rendering HTML (w/ javascript) and Converting to an Image
I have an HTML page that has Javascript code. It needs to be rendered first before it can be converted into an image. I am aware of projects like wkhtmltoimage, PhantomJS, khtmltopng, webkit2png, ...
1 vote
4 answers
3k views
Does anyone know a way to print the loaded page HTML after DOM is completed?
I'm looking for a way to read the source code of a page after it finished loading and inspect the code to see if it contains a specific text. I found this reference but this only returns the text ...
1 vote
2 answers
2k views
How to use JavaScript to count occurence of a word in entire HTML webpage versus just in an array?
I have a JSON report that I append to my webpage that monitors a server's processes and every processes that is running it returns the string "runn1ng". I want to do a summary at the top of the ...
1 vote
1 answer
2k views
How do I render HTMLDocument type in React render
I have something like this public render(){ let htmlRender = "<html><body><h2>Children</h2>Joe has three kids:<br/><ul><li>Linn Fenimore Cooper Cary (...