Would it be possible for me to have the URL of a given page change depending on what Vertical Tab the user clicks on the page?

For example, when a user is on a complex node form on my site, there are many tabs, each one providing a separate group of information about the node. I'd like for the user to be able to click on a link inside one of the fieldsets, and be able to click the back button to jump straight back into the fieldset he was viewing previously.

Right now, since the fragment isn't in the URL, the user is always brought back to the first vertical tab, regardless of which was open when a link was opened.

If I manually enter the fragment of the #id of the vertical tab that should be opened (like example.com/node/200/edit#my-vertical-tab-id), that works. Is there a simple way to make it so that when a user clicks on a vertical tab, it's anchor fragment is appended to the end of the URL?

  • This is an interesting question but is probably not Drupal specific? Commented Jul 5, 2011 at 15:53
  • Maybe not, but would there be a way to do this using jQuery + HTML5's url popping feature? Something along these lines: stackoverflow.com/questions/824349/… Commented Jul 6, 2011 at 22:12

1 Answer 1


You could use JavaScript to change the URL fragment each time a tab is opened (click listener on the tab changes the fragment to that tab's ID). But that would only allow the user to go back and have whatever the last tab they opened before following a link remain open.

If you want to save the state of many opened/closed vertical tabs I can't think of a solution that doesn't involve reading/writing constantly to a DB. Maybe you could get away with using cookies instead? Either way its gonna be messy.

  • JS is probably the best way to do this, I guess. Anyone care to help take a crack at this? I don't have the time right now, as I've moved on to another project :-/ Commented Aug 16, 2011 at 2:41
  • I plan on doing this with jQuery, but don't have time to code it now; hopefully will get some time soon, and I'll post back here with the result. Commented Jan 5, 2012 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.