Home>

I want to do string matching in the page of the specified URL.

The way to image is to store the entire page of the specified URL in the string str,
I imagine it as str.match ("hoge"), but how do I get the entire page string
Can be stored in str?

  • Answer # 1

    When executing JavaScript in Node.js, there are modules such ashttpandrequest. Please use them.

    In the case of a web page in a browser, sites in other domains have CORS, so basicallycannot get.

  • Answer # 2

    var str = document.body.innerText;


    How about it? textContent is fine.

Related articles