javascript - ajax pagination issue with history.back() -


==> load page n ==> click list ==> list detail page.
when "previous button" browser, landed in page 1, not page n.

i realized ajax pagination has issue.

as of now, can think of workaround solution, :
- after clicking list, open new tab instead using original tab.
  at least user don't struggle find previous page n.

is there other solution ?
specific, how land in page n after clicking previous button browser (with ajax pagination)?

you can modify browser's history using

history.pushstate() or history.replacestate()

so, when load page n, run (as per mozilla developer's page)

var stateobj = { foo: "bar" }; //save data here if url not descriptive enough

history.pushstate(stateobj, "pagetitle", "pathname");

if using stateobj need listen 'popstate' event retrieve data , restore appropriate state.

this part of html5 spec, might not work in older browsers.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -