My issue is very similar to these questions, where I am trying to use a link to change tabs, but the link only changes the tab content, but not the active tab.
Most
You could use window.location.href to get something like http://domain.com/index.html#tab1
window.location.href
http://domain.com/index.html#tab1
(not tested) but you could put:
if (window.location.href.replace("#", "") == "tab1") { //change tab }