Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

How would you save the current tab after refresh using this script?

What would be a good way to save the current tab after refreshing the page when using this script: https://www.w3schools.com/howto/howto_js_full_page_tabs.asp

Is my only option to use AJAX when clicking a tab then storing the tab value in a Session?

or, set a query string?

0 likes
4 replies
vincent15000's avatar
Level 63

You can for example store the tab position in the localStorage.

1 like
Ligonsker's avatar

@vincent15000 I came here to say that!!! That's what I did and it worked, thank you!

Do you know if having too much local storage can affect UX? Currently I only have but curious

1 like
vincent15000's avatar

@Ligonsker You can have as many keys as you want in your localStorage. You just have in mind that all data you put in the localStorage is visible by anybody who wants to read its content.

1 like

Please or to participate in this conversation.