how to create back button with different parent location using javascript or Jquery

Ask a question


i created back button where page1 and page2 redirects to page3.
When back button is clicked on page3, it redirects back to page1 or page2 accordingly. I used document.referrer which sometimes returns page itself instead of parent location.
That is when click back button on page3 it redirects to page3

function GoBackWithRefresh(event) 
    if ('referrer' in document) 
        var ref = document.referrer;
        console.log("document referrer_____<BR>"+ref);
        window.location = document.referrer;
        /* OR */
        console.log("window history____"+window.history);
Coin iconoffer bounty
add comment

0 Answer

Your Answer