part of the URL
        history.replaceState(null, null, url.toString());
    }

    // Activate the tab and scroll to anchor based on the URL when the page loads
    activateTabAndHeaderFromUrl();

    // Update URL query parameters when a tab is shown
    $('.nav-tabs a').on('shown.bs.tab', function (e) {
        clearPreviousAnchor(); // Clear any previous anchors before switching tabs
        var tabName = $(e.target).attr('data-tab-name');
        var parentTabPane = $(e.target).closest('.tab-content')