This question has already been answered:

How to get all the contents of an HTML page?
For example, https://ru.stackoverflow.com/ .

Reported as a duplicate by Grundy members, Community Spirit Jul 22 '16 at 11:11 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Also here there is an answer with getting the site content - Mr. Black

2 answers 2

XMLHttpRequest is used for this purpose.

var http = new XMLHttpRequest(); http.open('GET', 'http://ru.stackoverflow.com', true); // составить асинхронный (по умолчанию true) GET запрос страницы http.onreadystatechange = function () { // обратная связь: отдаёт ответ на запрос if (this.readyState == 4 && this.status == 200) { // отследить момент, когда пришёл полный ответ alert( this.responseText ); // this.responseText — ответ в виде текста } } http.send(); // отправить запрос 

Read more about XHR

Learn more about cross-domain queries.

  • This design hhr, I have not seen - Mr. Black
  • @Doofy are you talking about? - Mihanik71
  • About the crutch from above. What does the input ? - Mr. Black
  • @Doofy I apologize, not all unnecessary cut - Mihanik71
  • Firstly, tips on writing code , and secondly, before answering, it is advisable to check the code for operability. The code will not work, because Access-Control-Allow-Origin - Mr. Black

var content = document.body; content is page content

  • What kind of nonsense, sorry? (minus not mine) - Mr. Black
  • agree nonsense, but this is the answer to the question ...) - Igor Kalinchuk
  • Are you sure you understood the question? - David Kern
  • 3
    and how can you understand the question? - Igor Kalinchuk am