Open pflstr opened 5 years ago
Cookies are used to store the session, which I assume is why we show the no-js page when they are disabled.
We do probably want to improve the no cookie experience in the near future, same as the no-js experience.
Cookies are used to store the session, which I assume is why we show the no-js page when they are disabled.
But we don't really need sessions for guests, do we? Discourse and NodeBB both don't show any hiccup with blocked cookies.
A lovely benefit of going without sessions unless we really need them (log in) would be the ability to get rid of these annoying cookie consent banners for guests.
For the sake of completeness, there is a discussion in the Flarum forum touching this issue:
Turns out we already have flarum/framework#474 about this, but I'm closing that one because this one is newer and has more information / discussion.
We don't have any special checks for cookies being enabled, as far as I am aware. To be honest, I don't think that is even possible.
What we have is a line like this: https://github.com/flarum/core/blob/d7a5a6ad14c351d402442daa93eb8cc871f110ef/js/src/forum/components/HeaderSecondary.js#L54
Is it possible that this raises an exception when cookies are disabled? I could not find anything about such an exception when googling a bit.
@pflstr You mention "browsing" a Flarum forum. Did the error just appear at some point in time (the code I linked is executed when changing the forum's language), or immediately when opening the forum?
@franzliedke
We don't have any special checks for cookies being enabled, as far as I am aware. To be honest, I don't think that is even possible.
It is quite simple in the frontend. Just set a cookie and check thereafter if a cookie with the given name exists.
You mention "browsing" a Flarum forum. Did the error just appear at some point in time (the code I linked is executed when changing the forum's language), or immediately when opening the forum?
It happens immediately when entering the site.
In that case, we need to find out the root cause.
@pflstr May I ask you to do some experiments, e.g. disabling all extensions, and then re-enabling them one-by-one (in case the no-extension version does not have the problem)?
Bug Report
Current Behavior
When browsing a flarum forum with cookies blocked in my browser I am presented with the no-js version of the site. The banner in the header says "Something went wrong while trying to load the full version of this site. Try hard-refreshing this page to fix the error." Unfortunately (albeit expectingly) refreshing the page doesn't fix anything.
Expected Behavior
If cookies were essential for the execution of javascript I would expect to see a message asking visitors to allow cookies for the site.
If cookies aren't essential for visitors who are not logged in (and I can't see why cookies should be essential in this case) then the page should load without problems even if cookies are blocked by the browser. If visitors then try to register or login, they should be notified that from here on cookies need to be enabled.