View Full Version : Get get complete url of a page, including the active tab

11-13-2011, 10:27 PM
1) Script Title: Demo #2- Different Tab Style, expanding of arbitrary DIVs on the page enabled

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex17/tabcontent.htm

3) Describe problem:

As you can see in demo#2, when a tab is selected the url in the browser dont change.
Let'us assume that we want to add a feature that allow a user to save in a browser favorite or in a database the url of the page that he likes. In this case it seems necessary to get a complete url, including the active tab.

1 - Is it possible to do this using javascript? If yes, How?

2 - Is there other way to do this? If yes, which one?

Thanks in advances.


11-14-2011, 04:31 PM
The script does support selecting a tab by using a URL parameter (ie: currentpage.htm?flowertabs=1). See the section "Dynamically selecting a tab using a remote link (v2.2 or above)" on the script page for details on this.

With that in mind then, if you want the currently selected tab to also be bookmarkable, one approach would be to use HTML'5 pushstate API to dynamically append to the page's URL a parameter string without reloading the page. The parameter string would consist of the string "?tabid=selectedtabindex", so bookmarking the page and returning to it will load the corresponding tab as well. HTML5 pushstate is supported in FF4+, Chrome/Safari 5+, and Opera 11.5+. No IE support yet. Try the below modified .js file, which adds this feature to the script.

11-14-2011, 07:54 PM
Thanks very much for support. After testing a post reply.