localStorage == null in wh_topic page

Oxygen general issues.
revaljilji
Posts: 23
Joined: Mon Sep 09, 2019 3:07 pm

localStorage == null in wh_topic page

Post by revaljilji »

I added two buttons to wh_tools element which will help user to go directly to results of the last search and show them instead the toc menu. I used localStorage/sessionStorage to save the HTML results in displayPageResults() function in search.js. Upon loading the wh_topic page, I use getter and get the item I saved and asign the action to the buttons 'Suchergebnisse' (which will change the toc menu to search results picture 2) and 'Inhalt' (which will bring the toc menu back picture 1). This works fine and the localStorage contains the value of the search HTML, but it works only for the first topic (in this case FOO1 picture 1). When I click any other, the localStorage with that key is equal to null. Going back to first topic again would work. Do you maybe know the reason behind this or maybe is there another aproach to this?

Edit: Just found out that this was the standard feature with webhelp classic. Is there a way to activate/add it for the wh responsive too?
FOO1_TOC.PNG
FOO1_TOC.PNG (4.68 KiB) Viewed 1289 times
FOO_SEARCH.PNG
FOO_SEARCH.PNG (9.01 KiB) Viewed 1289 times
Attachments
image.png
image.png (8.36 KiB) Viewed 1289 times
alin
Site Admin
Posts: 268
Joined: Thu Dec 24, 2009 11:21 am

Re: localStorage == null in wh_topic page

Post by alin »

Hello,

Can you please give us more details about your customization. More specifically, how did you include the JS that retrieves the data from local storage in your output files?
Are there any JS errors the browser's console?
Also, we would need to know which version of Webhelp are you using.

Regards,
Alin
Alin Balasa
Software Developer
<oXygen/> XML Editor
http://www.oxygenxml.com
revaljilji
Posts: 23
Joined: Mon Sep 09, 2019 3:07 pm

Re: localStorage == null in wh_topic page

Post by revaljilji »

Thank you for reply. However the problem was with the Firefox browser. Apparently they don't support local-/sessionStorage on local transformations, but only on published ones.
Post Reply