Obviously, it looks like a known problem (just type "window location reload not working on firefox" and you'll get a lot of results)

More precisely, Firefox doesn't seem to send the right cookie when reloading the page...
- When I click to login, once Facebook logged me in and sets a cookie, Firefox doesn't send any cookie
- When I click to logout, once Facebook has logged me out and remove the cookie, Firefox sends the cookie that was previously there.I conclude it uses some "cache functions".

6 Answers
6

Try wrapping the window.location.reload() call in a setTimeout() with a zero delay. Apparently, Firefox fires the event before setting the cookie. The wrapping should place the reload call in the event queue and allow the cookies to be set correctly.

Incase there was anymore confusion over this, for Firefox, the above referenced example of setTimeout() works perfectly. Simply include your reload call, or if it's easier just replace:

document.location.reload();

with:

setTimeout('document.location.reload()',0);

Using the most recent version of Firefox released, I have tested every example above, and this is the only one that has actually worked consistently. Basically, you just need to "pause" the JavaScript just for a moment to let the rest of the script catch up. I did not test this on Chrome or IE, but it does work flawlessly on Firefox.