new WWW(s_url) works in Editor but hangs in browser

We’ve got really simple WWW class code, nearly copied from the Unity script reference. We’re using absolute paths. But it fails when we make a build and run it in the browser.

var w3_file : WWW;
var s_lang_url = "http://www.google.com"; //just a very simple, very common page
w3_file = new WWW (s_lang_url); // Start a download of the given URL
while ( w3_file.isDone == false) {
     //We could put in progress bar here
}
//more code

Isn’t this supposed to work? In a browser it just says “read www.google.com” and hangs. But it works great in the Editor.

We tried reading from a file on the same domain, in the same folder, as the Unity build. But it’s still failing.

Don’t use a “while” loop. Unity may need to advance the frame in order to read the downloaded data. WWW transfers are asynchronous.

Instead, in the Update or in a coroutine, check isDone and let the frame advance if it isn’t. Keep checking at most once per frame until it’s done.

EDIT: From the documentation,