javascript - I can't seem to figure out how to manipulate the browser history -
so trying change data based on navigation of user. have 6 main category pages. 6 main category pages, have 12 sub categories user can select.
what trying achieve:
let's user selects category one.
- the user selects sub-category 1 category 1.
- the sub-category page shown , removes data not related category 1.
- the user selects sub-category 2 sub-category 1 , removes data not related category 1.
- the user selects sub-category 3 sub-category 2 , removes data not related category 1.
so can category 1 sub-category 1 how lets says sub-category 1 2 , 2 3...n times....? each sub-category has know main category last selected.
i have looked @ can't seem find solution.
window.location.hash history.pushstate("","",""); document.referrer
typically bad design , understand limited can on server side. trying develop work around....
after trying work these , not getting desired behavior, able find best solution through several hours of research. alternative find passing around data on client side between pages.
window.location.hash history.pushstate("","",""); document.referrer
so lets user navigates category1
you set session storage object
sessionstorage.setitem('last-category', "category1");
the user navigates sub-category 1. can use session storage of object , show last set operation object.
sessionstorage.getitem("last-category"); -> output category1
the user navigates sub-category 2
sessionstorage.getitem("last-category"); -> output category1
the user navigates category 2 set session storage object again show category2
sessionstorage.setitem('last-category', "category2");
the user navigates sub-category 1
sessionstorage.getitem("last-category"); -> output category2
Comments
Post a Comment