Make custom URL to open tab

Hi, I have a tab and I want to open specific tab with URL. What I’ve been done to do this is :

<script>
var Webflow = Webflow || [];
Webflow.push(function () {
  var tabName = getParam('tab');
  if (!tabName) return;

  $('.' + tabName).triggerHandler('click');

  function getParam(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
      results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  }
});
</script>

That script is works fine with this URL http://example.webflow.io/faq?tab=cafe but I want to change that URL with this http://example.webflow.io/faq#cafe

Anyone know how to make that script works with that URL ? Thank you.

Hi, there’s a known easy method to target a specific TAB with a link. Here’s a link to @danro’s post:

The URL you’d want to use is actually a working URL with anchor to an ID. (links to the element with ID #cafe). I don’t know if it’s possible to make it target what you want instead.