I've back button in my site and i want to hide, if there is no back URL available(i.e from my site). i used history
of JS to check history.length
and go()
for back to previous URL. To check back URL is from my site or not i used
var prev_url = document.referrer;
if(prev_url.indexOf(window.location.origin) === -1){
// hide back button
}
which is working fine but document.referrer
is changed if i clicked other link in my site and if i go back to previous page then the document.referrer
is referring forwarded link which i don't want. i want current opened page previous URL not referrer URL. if anyone have any other option than document.referrer
this let me know plz.
If have any other solution.. will be helpful.
Thanks.