I have a node app. Let's say the url is like this:
http://www.testurl.com/?access_token=1234
. This url gets generated by Spotify as this access_toke
n is required to use their API.
Only if the user refreshes the page I want the url to remove the last part of the url and just load http://www.testurl.com
. It is important that it only happens on page refresh, so that the user has to authenticate themselves again.
I have tried these js solutions, but none of them work. I think they didn't work for the original poster also as there was no accepted answer.
I have seen that it is possible to detect browser refresh using php. Does anyone know if it is possible to detect the equivalent using node
?
The php solution looks like this
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0';
I have also tried the following, that didn't work either.
window.onbeforeunload = function(event){
window.location.href = 'http://www.google.com';
};