How can I provide the users to bookmark my ajax driven pages?

I used html 5 history api in a laravel project.

when ever I made a ajax requests from my navs I push a state.

history.pushState('/products', null, '/product')

On reload, I used popstate() and send ajax request with my state.

window.onpopstate(function(e){

ajaxRequest({url : e.state}) //e.state = "/products"

})

everything is working fine. But when I bookmark i can bookmark the site with the current history state.

But when I try to use the bookmark. It is not getting the required files as history.state will be null. How can i handle this?

​

You can try bookmarking on this site https://cratesonskates.systha.com/

Posted Dec 14, 2019, 8:29 AM UTC

13
Loading comments…