Ajax脚本可以访问不同网站的网页吗?

发布于 2025-01-02 05:42:04 字数 128 浏览 2 评论 0原文

Ajax脚本可以访问不同网站的网页吗?例如我尝试遵循

xmlhttprequestobj.open("GET","google.com",true);

这段代码有什么问题吗?

Can an Ajax script access different website's webpage? for example i tried following

xmlhttprequestobj.open("GET","google.com",true);

What is wrong with this code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

离去的眼神 2025-01-09 05:42:04

不,由于同源政策,它不能: http://en.wikipedia.org/wiki/Same_origin_policy

No, it cannot, due to the Same Origin Policy: http://en.wikipedia.org/wiki/Same_origin_policy

怂人 2025-01-09 05:42:04

如果 endurl (在您的情况下.. google.com)支持以 jsonp 格式返回数据,则您的请求有效。

Your request is valid if the endurl (in your case.. google.com) supports returning data in jsonp format.

糖果控 2025-01-09 05:42:04

不,您无法访问其他域和主机的网页,即使我尝试了您尝试过的相同操作,由于安全原因浏览器不允许这样做。

No, you cannot access webpages of other domains and hosts, even i tried the same thing you tried, due to security reasons browsers do not allow so.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文