Webplayer crossdomain problem

Hey!

As the title says, I 'can’t get this to work. I keep getting SecurityException complaining about crossdomain. The thing is that I shouldn’t have the problem since I host my game.unity3d file on the same domain. If I use a relative path in my WWW call it works fine, the problem is that the game will be run in an IFrame on Kongregate, and relative paths doesn’t seem to work. (maybe that can be solved?)

I have put a crossdomain.xml at the base of my domain (copied the policy from the documentation). I can view the file by typing in the url mydomain.com/crossdomain.xml without any problems. Doesn’t work when I deploy the game though.

System.Security.SecurityException: No valid crossdomain policy available to allow access
at (wrapper managed-to-native) UnityEngine.WWW:get_bytes ()
at UnityEngine.WWW.get_text () [0x00000] in :0

I tried uninstall the unity webplayer and install the newest. I use Firefox 3.6.10. Not sure what else to try.

Does anyone know what I might have missed?

Would be very thankful for some tips.

Ok, found the problem. The iframe was pointing at the www subdomain and webplayer asking for crossdomain without the www. So now that seems to be working.

are you fetching the policy file before you open any connection ?

The webplayer does it automatically when I use the WWW-class. I got rid of that exception by removing www from www.mydomain.com. Silly mistake.

Add crossdomain.xml file in your server root directory for example if you are working on localhost then on “http://localhost:3537/crossdomain.xml” location there should be a file present having the contents as

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

but keep one thing in your mind that is XML should be in ASCII encoded scheme. ANSI (8 bits) encoding scheme which is similar to ASCII (7 bits), use notepad for this purpose. and specify the encoding scheme, because some text editors saves by default in other formats.