来自网络浏览器的跨域调用

发布于 2024-09-10 19:48:01 字数 147 浏览 6 评论 0原文

我想从网站执行跨域 http 请求。我有什么选择?

Javascript 已经过时了,因为大多数浏览器不允许跨域调用。通常,解决方案是使用代理,但这不是此项目的选择。

我考虑的其他事情是使用 Flash 或 Java。还有其他我可以使用的平台吗?

I would like to execute a cross domain http request from a website. What are my options?

Javascript is out, because most browser don't allow cross domain calls. Generally the solution is to use a proxy, but that isn't an option for this project.

The other things I was thinking about would be to use Flash or maybe Java. Are there any other platforms that I could use?

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

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

发布评论

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

评论(4

泛泛之交 2024-09-17 19:48:10

“Javascript 已经过时了,因为大多数浏览器不允许跨域调用。”

不幸的是,Javascript 肯定会出现。您只需使用您喜欢的任何 src url 添加一个新脚本到页面即可。它被称为跨站脚本(或XSS )。在我看来,它引入的漏洞使得浏览器监管“同源”策略的所有其他尝试都变得毫无意义。他们只是想修补一条已经掉到脚踝处的裤子上的破洞。

"Javascript is out, because most browser don't allow cross domain calls."

Unfortunately, Javascript is most definitely in. You just have to add a new script to the page with whatever src url you like. It's called Cross-Site Scripting (or XSS). IMO, the vulnerability it introduces renders moot all the other attempts by browsers to regulate a "same-origin" policy. They're just trying to patch a hole in a pair of pants that have already fallen down around your ankles.

锦爱 2024-09-17 19:48:09

如果您对要向其发出跨域请求的服务器具有管理访问权限,则可以使其提供 Flash 跨域策略文件,以授予另一台或多台服务器跨域访问权限。然后,其他服务器需要使用 Flash 来发出跨域请求。

如果您正在寻找一些可以帮助您入门的东西,请查看开源 Forge 项目。它在 JavaScript 中公开了跨域 XmlHttpRequest API,因此您只需编写 JavaScript 代码:

http ://github.com/digitalbazaar/forge/blob/master/README

If you have administrative access to the server you will be making a cross-domain request to, then you can make it serve a Flash cross-domain policy file that grants another server (or servers) cross-domain access. Then that other server needs to use Flash to make its cross-domain requests.

If you are looking for something to help get you started, check out the opensource Forge project. It exposes a cross-domain XmlHttpRequest API in JavaScript so you only have to write JavaScript code:

http://github.com/digitalbazaar/forge/blob/master/README

み格子的夏天 2024-09-17 19:48:08

Java 和 Flash 都支持 crossdomain.xml 文件,分别在 Oracle 和 Adob​​e 网站上进行了记录。

W3C 正在制定采用不同方法的标准。当哪个系统实现这一点时,我无法预测。

Both Java and Flash support crossdomain.xml files, as documented on Oracle and Adobe sites respectively.

W3C is working on a standard that takes a different approach. When that gets implemented by which systems, I cannot predict.

寂寞清仓 2024-09-17 19:48:07

您必须坚持使用代理解决方案,因为 flash 和 java 与 javascript 具有相同的跨域限制。如果这仅供个人使用,据我所知,有一个选项可以使用 Flex 构建器和 falsh 播放器的调试器版本来发出跨域请求。

You will have to stick with the proxy solution because flash and java have the same cross-domain restrictions as javascript. If this is something that is only for personal use, there is an option as I know with the flex builder and the debugger version of the falsh player which can make cross-domain requests.

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