Search code examples
javascriptbrowser-history

Back behavior using JavaScript


I have written JavaScript for back button like this and my HTML is

<a onclick="goBack()" href="javascript:">

and

function goBack() {
    window.history.back(1);
} 

my path is:

home-> page A -> Page B

its works fine when i try to redirect from page B to A works perfect but issue is than when i click on back button on page A than its take me to page B not on home page.

So how can I resolve this issue? how it can store history????


Solution

  • I have put history.go(-1) its working on after proper build of app. so for if any has issue like i had so my suggestion is that please proper build your application. its working and some how its also doesn't support while you do test on browser.