rubisco-sfa / ILAMB

Python software used in the International Land Model Benchmarking (ILAMB) project
BSD 3-Clause "New" or "Revised" License
46 stars 37 forks source link

download of ILAMB directory not showing overall score colors in a local Mac browser (Chrome or Safari) #99

Open mcguirepatr opened 2 months ago

mcguirepatr commented 2 months ago

My supercomputer's web pages aren't working right now, so to view the ILAMB output, I needed to download the ILAMB directory to my Mac. But when I download the ILAMB directory , it is not showing the overall score colors on the main page in a local Mac browser (Chrome or Safari). Can you tell me what I should do to fix this? The individual pages (i.e., GPP->FLUXCOM) work fine. Patrick McGuire

mcguirepatr commented 2 months ago

When I open it up in Chrome Developer, I see this message: Access to XMLHttpRequest at 'file:///Users/pmcguire/Desktop/work/projects/ILAMB2/GCP_210824a4/scalars.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted. I will ask ChatGPT. Patrick McGuire

minxu74 commented 2 months ago

Please try to use python local http server by typing "python -m http.server" in the ILAMB directory. Then use the web browser to open "http://127.0.0.1:8000/index.html" to solve the cors error.

mcguirepatr commented 2 months ago

ChatGPT suggests that one option (not recommended for production) is: Disable CORS in Chrome: open -na "Google Chrome" --args --disable-web-security --user-data-dir="/tmp/chrome_dev"

This works! PCM

mcguirepatr commented 2 months ago

This option doesn't work with Safari 17.6, however. But I can use Chrome on my Mac instead, with this option, when the supercomputer webserver isn't working. PCM

mcguirepatr commented 2 months ago

Please try to use python local http server by typing "python -m http.server" in the ILAMB directory. Then use the web browser to open "http://127.0.0.1:8000/index.html" to solve the cors error.

It looks like I don't have python installed currently on my Mac.... Thanks for the tip, though. ChatGPT had also suggested this as an option. Patrick

minxu74 commented 2 months ago

The another way to solve it is to use the unified dashboard as it does not use XMLhttprequest from JQuery to load the json file. 1. try to open dashboard.html in the ILAMB directory using a web browser, 2. click the "browser...' button to load the "scalar_database.json", 3. click the menu on the left-upper corner to select two dimensions that you want to show and other interactive features.

mcguirepatr commented 2 months ago

Thanks, Dr. Xu! That was a great suggestion, and it works fine in Safari, after a quick test drive. Patrick