In JavaScript, is there a way to get source code of a given URL?

前端 未结 3 1692
感情败类
感情败类 2021-01-23 07:54

In JavaScript, is there a way to get source code of a page given its URL? Kind of equivalent to PHP\'s file_get_contents()

3条回答
  •  一向
    一向 (楼主)
    2021-01-23 08:26

    I can do this with Pretty Diff tool api: http://prettydiff.com/api.php

    The actual application, prettydiff.js, is JavaScript, and the service processing the requests on the server is also JavaScript. To see this in action go to the test link and use the "Source URI" method of input.

提交回复
热议问题