Reputation: 42450
I have a webpage which has three tabs, and depending on which tab is clicked, the appropriate content is visible. This showing/hiding of the content on clicking of tabs is handled by Javascript.
My issue is, if I am viewing the third tab and then refresh the page, the page does not refresh to the third tab's contents being visible but instead, back to the first tab's contents.
Is there any way, when the javascript executes, for me to add a GET parameter to the URL, so on page load my PHP script can check for the GET parameter and display the correct content?
Upvotes: 2
Views: 305
Reputation: 4717
Addtab id to the URL as an anchor when tab is clicked, e.g. http://www.mysite.com/page.html#tabId
Then when page loads you check for presence of tab id in url and activate required tab
Upvotes: 2
Reputation: 9172
You have a few options:
#tab3
to the URL)Depending on what browsers you want to support and how long you want to persist the option you can pick any of them.
Upvotes: 3
Reputation: 4782
You can use cookie, or link hash
. For example: http://jqueryfordesigners.com/api-filter-find/
Upvotes: 0