- Home /
The question is answered, right answer was accepted
WWW doesn't work on localhost eventhough crossdomain.xml exists
Hi guys!
I want to access data from my WAMP based database on my localhost. Only using the following script gave me an error:
 function Start() {
     hs_get = WWW('http://localhost/unity/');
     yield hs_get;
  
     if(hs_get.error) {
         print("There was an error getting the data: " + hs_get.error);
     } else {
         Debug.log(hs_get.text);
     }
 }
There was an error getting the data: Rejected because no crossdomain.xml policy file was found.
So I placed a crossdomain.xml in my localhost. Now if I open the following link: http://localhost/unity/crossdomain.xml I get the crossdomain.xml file. The file contains the following:
 <?xml version="1.0"?>
 <cross-domain-policy>
 <allow-access-from domain="*"/>
 </cross-domain-policy>
But still Unity gives me the same error :(
 There was an error getting the data: Rejected because no crossdomain.xml policy file was found
 UnityEngine.MonoBehaviour:print(Object)
 $:MoveNext() (at Assets/Avatar/Character/_Character.js:45)
I've been searching but cannot get an awnser! Can some one help!?
Answer by Bunny83 · Dec 14, 2012 at 06:04 PM
The crossdomain policy file have to be in the root. So Unity looks for it at this path:
 http://localhost/crossdomain.xml
To quote the above link:
 ...you would need to place a crossdomain.xml file at the root of the 
 highscoreprovider.net domain like this:
 http://highscoreprovider.net/crossdomain.xml
Thanks that was the problem, I though root of the website itself -.- Thank you! :D
Follow this Question
Related Questions
WWW does not work on localhost 0 Answers
Is it possible to open a web page inside Unity? 2 Answers
GetPixel error on downloaded texture even with crossdomain.xml 1 Answer
Crossdomain woes 2 Answers
www php send data to mysql 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                