Unity 5.2.2 webgl bundle loading failing

Hello there,

My problem is simple : bundle loading through the WWW class return “unknown error.” on a webgl export

using UnityEngine;
using System.Collections;

public class LoadingWww : MonoBehaviour {

  string content = "";

  IEnumerator Start(){
    content = "[LOADING INFO]";

    WWW www = new WWW("http://www.website.com/path/to/bundles/text");

    if (!www.isDone) yield return www;

    if (www.error != null)
    {
      Debug.Log("Failure : " + www.error);
      content += "

failure : “+www.error;
}
else
{
Debug.Log(“Success !”);
content += "
Success !”;
}
}

  void OnGUI(){
    GUI.Label(new Rect(0,0,Screen.width, Screen.height), content);
  }
}

Here “text” in the url is a bundle filled with .txt files

Works fine in the editor. Just doesn’t work on a webgl export.

www.error log : “Unknown error.”

Any ideas ?

Thanks for the help !

==EDIT==

It seems that the issue is linked to the distant domain having a CORS properly set. ( Unity - Manual: WebGL Networking )

But I have no idea how to do that.

So, the answer for my issue was something about security with crossdomain transaction ( Unity - Manual: WebGL Networking )

Just add this in a .htaccess file at root level of the target domain

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"