Javascript:如何获取网址的内容?

时间:2012-02-04 15:24:12

标签: javascript

As we know, we can use the function `file_get_contents(url)` in PHP to get content of a url.

但是,它可以在JavaScript中使用吗?

The `document.ElementById()` is only valid in current page.

我可以使用JS在网址中获取divclass吗?

此外,如果这些内容可以通过PopupBubble显示,我将非常感谢你。

1 个答案:

答案 0 :(得分:1)

您可以XMLHttpRequest使用Same Origin Policy制作HTTP请求,CORS可以使用{{3}}

绕过{{3}}