Refreshing a page is an operation that we have to do sometimes.
It does the same thing as the reload button in our browsers.
This method can only be called if it’s issued from the same domain as the app itself.
history.go method lets us load a specific page from the session history.
We can use it to move forward by passing in a positive number, and move backward if we pass in a negative number.
And if we pass in 0, we can refresh the page.
Passing in nothing to
history.go is the same as passing in 0.
It’ll also refresh the page.
location.href = location.pathname
We can assign
location.pathname , which has the part of the URL after the hostname.
We can assign it to
location.href to trigger navigation to the same page, which is the same as refreshing the page.
location.href is the property that we can assign to navigate to the given URL.