hundredrabbits / Dotgrid

Minimalist Vector Tool
https://hundredrabbits.itch.io/dotgrid
Other
1.04k stars 75 forks source link

Suggestion: Add Guidance on Usage via Browser, Suggestions, Pitfalls, etc. #74

Open shawntax opened 4 years ago

shawntax commented 4 years ago

Hello!

With the app now being delivered through a single html file (👏), folks who attempt to open the app locally (i.e through the file:///path URI) via a modern, Chromium-based browser will run into a hurdle:

Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.

If the "Block third-party cookies" setting is enabled.

A quick fix is to disable the setting, unblocking third-party cookies for all sites. But I would imagine the privacy-minded folks, myself included, wouldn't be too happy with that. Chromium allows you to add specific URLs or hostnames to an "Allow" list, however adding the specific file URI to the allow list does not work here because localStorage is per domain , and the file:/// URI scheme has an empty hostname by default (an insight gathered from this StackOverflow answer).

A workaround is to add localhost/127.0.0.1 to the "Allow" list, and then visit http://localhost/.../index.html using a local webserver. (adding localhost to the "Allow" list and then specifying the hostname in the file URI, e.g file://localhost/Users/me/dotgrid-main/index.html, does not work for some reason 🤷)


Would you consider adding a little section in the docs that describe some basics on opening via a browser, suggestions, pitfalls, etc. ? I know your philosophy is Linux-first and I've seen you recommend browsers like surf and Next. But I think some guidance here would be helpful for those using Chromium-based browsers starting, with the third-party cookie issue described above.

Thanks for all the great work!

neauoire commented 4 years ago

I will install chromium and do some testing, I believe that the theme tools is the only thing that uses localstorage, I might be able to work around that. Stay tuned :)

vintprox commented 4 years ago

There is some fuse about SameSite option for cookies, maybe it's related

shawntax commented 4 years ago

@vintprox are you referring to this?

While you'll see the warning in your console, it's unrelated. Dotgrid is not setting any cookies, just accessing localStorage.