In our login/logout javascript, which works in a modal box, I’d like to reload the current page after a user logs in our out, but only if the current page was not loaded as a POST–I don’t want to try to double post data to the server.
Is there any way to tell whether window.location.reload() will be sent as a GET or a POST, so that I can redirect POSTs to our front page instead?
JavaScript doesn’t have access to the request method [1], but you could check with PHP if there is any POST data, and set a JS variable:
Although this is not reliable (users could manually change it) so you shouldn’t rely on this to avoid duplicate data…