[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] WebGLSL Media Type Proposal
On Sun, May 20, 2012 at 11:23 AM, Thor Harald Johansen <email@example.com>
If we make XHRs the recommended method for loading GLSL code, there needs to be a way to load local files without creating security holes.
This is a platform-wide issue, not a WebGL one, and this is the wrong place to try to deal with it.
XHRs have one problem: They're meant to be HTTP requests. Using them for the "file protocol" isn't exactly semantically correct.
No, XHR for local files is perfectly fine. XMLHttpRequest is no more tied to HTTP than it is to XML; the name is purely historical.
The problems people hit with XHR (in Chrome, mostly, I think) are same-origin issues, which have nothing to do with XHR itself. You see the same issue when you try to load images from <img> into a texture, which results in an exception in Chrome if you're on file://. Chrome simply says that scripts are never allowed to see the contents of other files in the same directory when their origin is file://.
(And again, DOM-based loading solutions are the wrong way forward, due to workers, where DOM-based loading may never work.)