• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How to make browser remember in-page navigation history?

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a page which contains several tabs. Tabs are implemented by CSS and Javascript. All the tab contents are loaded when page is loaded. And Javascript code is used to show/hide related tabs. Tab switch does not cause page refresh and does not change the URL in the address bar.

My problem now is how to make browser history remember the tab selected: when user click the browser back button, it will go back to the previous tab selected, not the previous page. And the solution should not cause page refresh or add new URL parameters.

I know Facebook photo album implemented such feature.

Thanks in advance

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://code.google.com/p/reallysimplehistory/

http://www.pascarello.com/rememberHistory.aspx

Now with the second one, you need to implement a intervalthat looks at the url and see if it has changed. If it has, you fire your code to change tabs.

Some day HTML5 will be here and this will be history!

Eric
 
Kevin manoj
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric.

Thanks to your suggestion, I implemented the in-page tab navigation by using Method 1.

Now the only problem left is: when users click some link on the page and leave, and then they click browser back button, page always show the first tab, not the tab they stay before they leave. I checked URL, it seems that the current tab index is remembered( the number after #) .

The URL format is as follow:

http://www.XXX.com/shopping/PlanDetails.page?catalog_category_id=Realtime#2

I do not know why it does not show tab2 to customers. Anyone has a clue?

if I paste it into address bar and hit return, it works: Tab2 is shown up to clients.
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic