I am trying to make a Home
button on my html page but I cannot get it to work.
This home button should always load the home page, but it should load it from the cache.
The reason for that is there a number of checkboxes on the home page and when I do window.location = "myhomepage"
the page is reloaded in stead of loaded from cache, and all the checked checkboxes are empty again as are other input values.
I found that window.history.back()
does not always works well when the user opened other pages before hitting the back button.
So I tried with window.history.go("myhomepage")
but that does nothing at all. The page remains the same.
I have read the docs at https://www.w3schools.com/jsref/met_his_go.asp but it does not seem to work. My homepage is currently "http://localhost/test/index.php" so it tried it with this
windows.history.go("http://localhost/test/index.php")
but it does nothing at all.
I also tried variations like
.go("localhost/test/index.php")
.go("localhost/test")
but they all seem to do absolutly nothing at all.
Is there a special trick to get the window.history.go("url")
working ?
Or is there a better way to do this ?