how to determine which page is redirected?
i am using this code but this is not helping what i am looking for:
$(function () {
//var locate = window.location;
//var t = window.location.hash;
var pagename = location.pathname.substr(location.pathname.lastIndexOf("/") + 1, location.pathname.length).toLowerCase();
if (pagename == "toppages.aspx") {
$('#back_to_your_list').show();
}
else {
$('#back_to_your_list').hide();
}
});
EDIT:
So, I have a link on my home page (mydomain.com/employee/default.aspx) and once the user click on it then this will redirect to another page (mydomain.com/employee/toppages.aspx) from it there are other links and say the user click on a link called Background check and this will redirect to a different page and this time the url of this page will be (mydomain.com/employee/toppages.aspx?id=123)
the logic should be.
if the page is coming from mydomain.com/employee/toppages.aspx?id=123 then $('#back_to_your_list').show(); otherwise hide
i hope it make sense and confused 🙂
If you want to know what was the page on which a link was clicked leading to your page, simply use the referrer : https://developer.mozilla.org/en/DOM/document.referrer
A browser may be instructed to block it.
A different (hackish) solution for your own site could simply be to store the page in localStorage :