Monday, September 19, 2011

Resolving WebGL cross domain image loading error SECURITY_ERR: DOM Exception 18

If u have tried webGL and specially loading textures recently due to the tighter security features you get
 
Uncaught Error: SECURITY_ERR: DOM Exception 18 in Google Chrome and
Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: file:///some directory Line: 46] in Mozilla Firefox

Solution: The solution is quite simple. Just go to command prompt and change directory to where your html page is for example for running WebGL/Simple/Test.html u do this on cmd prompt

c:\> cd D:/WebGL/Simple/
Then simply type this

D:/WebGL/Simple>python -m SimpleHTTPServer

This opens up a local http server, let this cmd prompt run. Now go to the web browser firefox/chrome and type this in the address bar to load the webpage
http://localhost:8000/Test.htm

This should run the WebGL code fine. Once u r done, you can press Ctrl+C to terminate the http server. I hope it helps others from the pain which I had to bear.

2 comments:

Larza said...

Thanks for this info! Could it be possible to add this note to those lessons which use textures because the error is not obvious (found it out only because I use firebug on firefox) and the error was just "security error" and that it was somehow connected to textures which was obvious when I changed clearcolor to grey and the box coud be seen as black box without textures)

MMMovania said...

Thanks for the info Larza. I will add this to texture related tutorials if I have some later.

Popular Posts

Copyright (C) 2011 - Movania Muhammad Mobeen. Awesome Inc. theme. Powered by Blogger.