What is crossdomain.xml file?

夙愿已清 提交于 2019-11-26 11:23:05

问题


Actually I wish I knew where to start from...

I have embedded an third party SWF image gallery control, in an personal website of mine.

The SWF is XML driven. I load the XML file on the fly as follows....

  var flashvars = { xmlPath: \"http://www.example.com/xml.aspx\" };
                var params = { allowFullScreen: \"true\", wmode: \"transparent\", allowScriptAccess: \"always\"};
                var attributes = {};
                swfobject.embedSWF(\"main.swf\", \"gallery\", \"100%\", \"100%\", \"9.0.0\", \"expressInstall.swf\", flashvars, params, attributes);

The problem is that the page did not work as expected. Actually it worked only in Firefox, not in Chrome or I.E.

After checking the requests with fiddler, i found that the file crossdomain.xml was not found. So, stackoverflow helped me finding a sample...

<?xml version=\"1.0\" ?>
<cross-domain-policy>
  <site-control permitted-cross-domain-policies=\"master-only\"/>
  <allow-access-from domain=\"*\"/>
  <allow-http-request-headers-from domain=\"*\" headers=\"*\"/>
</cross-domain-policy>

After adding the crossdomain.xml the webpage now works in Firefox AND I.E. In Chrome i still have a problem.

So here are a couple of questions...

1) What is the crossdomain.xml?

2) How can i make my webpage work in Chrome too?


回答1:


"A cross-domain policy file is an XML document that grants a web client—such as Adobe Flash Player, Adobe Reader, etc.—permission to handle data across multiple domains.". Taken from Adobe website http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html.

EDIT: Answer to question 2: Flex crossdomain.xml not working correctly in Chrome/Firefox?. Install Adobe Flash Player for developers, Fiddler (or similar), these tools should make your life easier. Also read http://kb2.adobe.com/cps/839/cpsid_83950.html.




回答2:


And for all the newbies out there just like me, the SWF works in Chrome too!

The difference was that http://www.example.com and http://example.com are TWO DIFFERENT "entity s".

I was loading the file to var flashvars = { xmlPath: "http://www.example.com/xml.aspx" }; and made my tests with Chrome, on a "different domain" http://example.com



来源:https://stackoverflow.com/questions/4174317/what-is-crossdomain-xml-file

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