注意: crossdomain.xml必须是一个ASCII文件。
该文件要放置在服务器的根目录下,例如:www.sample.net/crossdomain.xml或http://ip:port/crossdomain.xml。
放到指定Web服务的路径下,如 http://ip:port/test/crossdomain.xml 我没有成功,了解FlashPlayer可以通过Security.loadPolicyFile(url)访问这样路径下的安全策略文件,但Unity3d如何访问,还要向试验成功的朋友请教。将mydomain更改成目标服务器的域名即可。
<!– http://www.xiaonei.com/ –>
? <cross-domain-policy> <allow-access-from domain=”*.xiaonei.com”/> <allow-access-from domain=”xiaonei.com”/> </cross-domain-policy> 这是很标准的做法,我就让我自己的域以及我的子域来获取数据。 淘宝的: http://www.taobao.com/crossdomain.xml <cross-domain-policy><allow-access-from domain=”*.taobao.com”/> <allow-access-from domain=”*.taobao.net”/> <allow-access-from domain=”*.taobaocdn.com”/> <allow-access-from domain=”*.allyes.com”/> </cross-domain-policy> 红色的一行是淘宝的CDN所在的域,所谓内容分发网络。 绿色的一行是淘宝的广告商了,http://www.allyes.com/好耶广告网络,只是不清楚是不是仍然再卖淘宝的广告? 多看几个大网站的crossdomain.xml,也可以知道可能是什么网络广告商给它们在打广告。 比如彭博:http://www.bloomberg.com/crossdomain.xml <cross-domain-policy><allow-access-from domain=”localhost”/> <allow-access-from domain=”10.16.136.107″/> <allow-access-from domain=”*.bloomberg.com”/> <allow-access-from domain=”*.pointroll.com”/> <allow-access-from domain=”*.pointroll.net”/> </cross-domain-policy> 红色的就太不专业了,把内部IP都给暴露了。。。。。。 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 个人微博:http://weibo.com/devouring
专门讨论:ps,vb,flash,动画,dw,as,asp,php等等。
同时介绍个QQ群给大家:23400043
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 绿色的是彭博的广告商:PointRoll 路透的: http://www.reuters.com/crossdomain.xml <cross-domain-policy><allow-access-from domain=”*.reuters.com” secure=”false”/> <allow-access-from domain=”ad.doubleclick.net” secure=”false”/> <allow-access-from domain=”ad.uk.doubleclick.net” secure=”false”/> <allow-access-from domain=”m.2mdn.net” secure=”false”/> <allow-access-from domain=”m2.2mdn.net” secure=”false”/> </cross-domain-policy> 广告给了doubleclick来做(绿色) 2mdn.net看不懂是干嘛的,大概是个cdn吧。 滥情的facebook: http://www.facebook.com/crossdomain.xml <?xml version=”1.0″?><!DOCTYPE cross-domain-policy SYSTEM “http://www.adobe.com/xml/dtds/cross-domain-policy.dtd”> <cross-domain-policy> <site-control permitted-cross-domain-policies=”master-only” /> <allow-access-from domain=”s-static.facebook.com” /> <allow-access-from domain=”static.facebook.com” /> <allow-access-from domain=”static.api.ak.facebook.com” /> <allow-access-from domain=”*.static.ak.facebook.com” /> <allow-access-from domain=”s-static.thefacebook.com” /> <allow-access-from domain=”static.thefacebook.com” /> <allow-access-from domain=”static.api.ak.thefacebook.com” /> <allow-access-from domain=”*.static.ak.thefacebook.com” /> <allow-access-from domain=”*.static.ak.fbcdn.com” /> <allow-access-from domain=”external.ak.fbcdn.com” /> <allow-access-from domain=”*.static.ak.fbcdn.net” /> <allow-access-from domain=”external.ak.fbcdn.net” /> <allow-access-from domain=”www.facebook.com” /> <allow-access-from domain=”www.new.facebook.com” /> <allow-access-from domain=”register.facebook.com” /> <allow-access-from domain=”login.facebook.com” /> <allow-access-from domain=”ssl.facebook.com” /> <allow-access-from domain=”secure.facebook.com” /> </cross-domain-policy> 这么多!有子域,有CDN,有thefacebook(facebook的旧域名吧?) 还是google的专业: <?xml version=”1.0″?><!DOCTYPE cross-domain-policy SYSTEM “http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd”> <cross-domain-policy> <site-control permitted-cross-domain-policies=”by-content-type” /> </cross-domain-policy> 蓝色行的意思是,要符合要求的文件你才能取,不管你是哪来的flash数据请求。符合要求的文档必须满足:Content-Type: text/x-cross-domain-policy 另: 当Flex访问WebService服务时,在本地能够正常访问,当部署到web容器中发布为web服务后,再调用WebServicIE,此时就会被拒绝访问,这就是Flex跨域访问的沙箱问题,
----------------------------------------------------crossdomain.xml的作用 ------------------------------------------------------
crossdomain.xml是adobe搞的,为了让flash跨域访问文件。 该配置文件放于服务器端的根目录下面。来设置让哪些域名下面的swf文件能够访问我服务器上的内容。 比如:我的服务器上有个图片:http://www.a.com/img.gif view plaincopy to clipboardprint? 该文件放在http://www.a.com/crossdomain.xml
--------------------------------------------------------UNITY3D----------------------------------------------------------------------
Implications for usage of the WWW class The Unity webplayer expects a http served policy file named "crossdomain.xml" to be available on the domain you want to access with the WWW class, (although this is not needed if it is the same domain that is hosting the unity3d file). For example, imagine a tetris game, hosted at the following url: http://gamecompany.com/games/tetris.unity3d needs to access a highscore list from the following url: http://highscoreprovider.net/gethighscore.php In this case, you would need to place a crossdomain.xml file at the root of the highscoreprovider.net domain like this:http://highscoreprovider.net/crossdomain.xml The contents of the crossdomain.xmlfile are in the format used by the Flash player. It is very likely that you'll find thecrossdomain.xml file already in place. The policy in the file look like this: <?xml version="1.0"?> <cross-domain-policy> <allow-access-from domain="*"/> </cross-domain-policy> When this file is placed at http://highscoreprovider.net/crossdomain.xml, the owner of that domain declares that the contents of the webserver may be accessed by any webplayer coming from any domain. The Unity webplayer does not support the <allow-http-request-headers-from domain> and <site-control permitted-cross-domain-policies> tags.
Note that crossdomain.xml should be an ASCII file.
|