This thread helped me. I haven't done a lot of web stuff, so it took me a while to discover that I needed to use emrun for the file system (FS) stuff to work. Since I'm using cmake, I added --preload-file and --emrun to my CMakeLists.txt linker step:
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s USE_SDL=2 -o ${PROJECT_NAME}.html --preload-file ${CMAKE_CURRENT_BINARY_DIR}/@/ --emrun")
But if you just open the HTML file directly then it gives you an error:
XMLHttpRequest cannot load file:///H:/code/build-emscripten/pemDemos.data. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
I guess the reason for this error is that the FS (file system) stuff requires a web server. But if I instead run (emrun --browser chrome pemDemos.html) then my simple OpenGL ES 2.0 demo works. The (--emrun) is a nifty bonus to print stdout to my console (eg Windows cmd.exe). cheers for the mailing list - I found this by searching the mailing list for "cross origin" :-)
I'm curious to understand exactly why emrun is necessary... Or if there's away to change my "browser CORS rules" such that I can just open the html file directly in the web browser instead of needing to use emrun...
Next I'm curious whether this will work (without effort) (so anyone can try my demo on my website from their web browser) when I upload the files (hello.html, hello.js, hello.data, hello.js.mem) to my web server via FTP... Of if there is more work I need to do for that to work properly?