History API back?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
16 views
Are you trying to connect history api but it does not work the back button in the browser , the title itself is changed but the page remains the same what's the problem?
if (data.status == 200) { var url = $(this).attr("href"); var title = $(this).attr("href"); if(url != window.location){ window.history.pushState('object', title , url); } document.body.style.overflow = 'hidden'; $('.lightbox-container').html(data.html); addEventListener('popstate', function (event) { event.state; // this contains the state data from `pustState`. Use it to decide what to change the page back to. }
by | 16 views

2 Answers

0 like 0 dislike
Ago
window.history.back(); window.history.go(-1);

Forward
window.history.forward(); window.history.go(1);
by
0 like 0 dislike
In the handler for the popstate must restore the application state
This is the state object passed as the first argument on history.pushState and passed to the event
It is also useful to maintain the initial state when the page is loaded through history.replacestate will
by

Related questions

0 like 0 dislike
1 answer
asked May 22, 2019 by cashloveyou
0 like 0 dislike
1 answer
asked Apr 12, 2019 by cashloveyou
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
asked Mar 21, 2019 by ertaquo
110,608 questions
257,187 answers
0 comments
40,796 users