Can I violate the same-origin policy with a Java applet

青春壹個敷衍的年華 提交于 2019-12-14 04:18:38

问题


I need to request things and get information from other domains. I know javascript can not do this due to the same origin policy. My other option is to make proxy requests through my server. I do not want the requests coming from my server's IP nor do I want to create additional load for my server and would prefer the client do it.

Is it possible to use a Java applet to do this? Manually configuring security settings is not an issue.


回答1:


Java applets do implement the same origin policy, much the same way as Flash. Java will prevent applet-based cross-origin calls if the target server does not have a properly defined publicly accessible crossdomain.xml.

A simple crossdomain.xml would look like this:

<?xml version="1.0"?>
<cross-domain-policy>
  <allow-access-from domain="*" />
</cross-domain-policy>


来源:https://stackoverflow.com/questions/19037659/can-i-violate-the-same-origin-policy-with-a-java-applet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!