ttscoff / cheaters

Customizable cheat sheet system for OS X
466 stars 108 forks source link

CORS: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. #14

Closed khit closed 10 years ago

khit commented 10 years ago

Hi Brett,

I just got around to updating my previously working version (2.0, stored in Dropbox) to 2.0.5. After updating, the nav will load but cheatsheets won't. I decided to remove all layers (Dropbox, Fluid) and run it directly from local hard drive but get the same thing (Chrome or Safari - OS X Mav). When I check Dev Tools I see errors like this in the console:

Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/css3.html XMLHttpRequest cannot load file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/css3.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. cheat.html:1 Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/patternsregex.html

I noticed that jquery-1.7.1.min.js was removed in this version but I don't think that's the answer because my old cheat.html file was calling jquery-2.0.3.min.js anyway.

Any thoughts on what I'm doing wrong? Thanks! I love this thing! kh

ttscoff commented 10 years ago

If you're using it in Chrome, you have to load it from a web server, not from a file. You can do this with a virtual host locally or by placing it on a remote server (or possibly even from the Dropbox public folder with an http url). Let me know if that's the issue.

-Brett

On 13 Feb 2014, at 17:24, Kye Hittle wrote:

Hi Brett,

I just got around to updating my previously working version (2.0, stored in Dropbox) to 2.0.5. After updating, the nav will load but cheatsheets won't. I decided to remove all layers (Dropbox, Fluid) and run it directly from local hard drive but get the same thing (Chrome or Safari - OS X Mav). When I check Dev Tools I see errors like this in the console:

Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/css3.html XMLHttpRequest cannot load file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/css3.html. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. cheat.html:1 Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. file:///Users/khit/Dropbox/Apps/Cheaters/cheaters/cheatsheets/patternsregex.html

I noticed that jquery-1.7.1.min.js was removed in this version but I don't think that's the answer because my old cheat.html file was calling jquery-2.0.3.min.js anyway.

Any thoughts on what I'm doing wrong? Thanks! I love this thing! kh


Reply to this email directly or view it on GitHub: https://github.com/ttscoff/cheaters/issues/14

khit commented 10 years ago

Yup, that's it! (I saw same in Safari too. And wasn't able to serve it using a Dropbox share link.) Thanks for the help!

khit commented 10 years ago

Upon further review...

Apparently when you create a new Fluid.app it locks down browsing to only the local path used when initially creating the app. Head to Preferences > Whitelist to see/update this setting.

Given the new cheaters file structure I updated the URL (under Preferences > General) but failed to update the Whitelist. (I just chose Allow browsing to any URL). All good now!