slowe / Chromoscope

Chromoscope lets you explore our Galaxy (the Milky Way) and the distant Universe in a range of wavelengths from X-rays to the longest radio waves.
http://www.chromoscope.net/
39 stars 8 forks source link

Loading KML in Chrome #16

Closed ebressert closed 13 years ago

ebressert commented 13 years ago

Loading KML files in Chromoscope does not work in Chromoscope, whereas FireFox 4 and Safari work fine.

ebressert commented 13 years ago

Yikes, too many "chrome*". I meant that Chromoscope does not work in Google Chrome.

slowe commented 13 years ago

:-)

I've been working on the code today so could you get the latest code and try it again. It works for me e.g. http://www.chromoscope.net/1.3.2/?kml=merlin.kml

ebressert commented 13 years ago

Didn't work for me. I'm using Chrome 12.0.742.30 beta in OSX. Could this be the problem?

ebressert commented 13 years ago

Update, the link you sent works. But the latest code from github doesn't appear to solve it.

slowe commented 13 years ago

Hmmm.Very strange. Version 11.0.696.68 is fine for both local KML and when on a server.

ebressert commented 13 years ago

May have spotted where the issue is. In the URL you provided, the KML is assigned there. I'm assigning the KML file in the chromo variable, e.g. "chromo = new Chromoscope({kml:thefile.kml})"

slowe commented 13 years ago

The query string and the hard-coded method both call the same function. I think the problem may be that, for HTML files hosted locally, browsers are increasingly strict on what the are allowed to do. The KML file gets read with an AJAX request to the file in the same directory. However, browsers seem to "taint" all files on the local file system which stops them being read. A way around it in Chrome is to start up Chrome with the option " --allow-file-access-from-files". I'm not sure if there is another way to read the KML file that doesn't run into this issue when run locally.

I don't understand why browsers are so paranoid about having access to files within the same local directory. At least they still allow the page to load images.

ebressert commented 13 years ago

Bingo - good catch. When running Chrome via the command line I do: open /Applications/Google\ Chrome.app --args --allow-file-access-from-files

Then it works. Thanks!

slowe commented 13 years ago

Make sure you don't normally browse using that option.

This issue has been raised by others on the Chromium issues site http://code.google.com/p/chromium/issues/detail?id=47416 The developers seem to have taken a much stricter line than other browsers. They don't seem to want to even allow a locally hosted webpage to access files in the same directory. They don't think that counts as "same origin". I've starred the issue but don't have much hope that they'll do something useful.