The point of the question is that after loading the page you need to check its url and if the URL, for example, looks like this:

http://example.com/index.html#sometab 

then make an active tab with id="sometab" . And if the url does not contain any "anchors", then do nothing.



    2 answers 2

     if(/#sometab/.test(location.href)) { //какие-то действия } 

      It is possible like this: (just the construction is more transparent)

       if (location.hash && location.hash == "#sometab") { // действия }