What is better to use: history.back();
, history.go(-1);
, a new request entirely, or something completely different?
What is the real difference between history.go(-1);
and history.back();
?
What is the best way to keep reliable performance (pages load without skipping or pushing forward), data integrity (loading a page as if it was a refresh, but keeping the request), but adhere to good coding practices?
According to MDN standards history.back();
is equalant to pressing back button and history.go(-1);
is equalant or shortcut for history.back();
. If you are using so many page navigations in one code
(For example,
history.go(1) //forward;
history.go(-2) //go back two pages;
consider using history.back();
to aviod confusion.