Trocando a URL ao clicar em abas com javascript

Um exemplo:

$('.nav-link').click(function(){         let href = $(this).attr('href');         var url = window.location.pathname+''+window.location.search+href;         window.history.replaceState("", "", url);     });

E pra clicar automaticamente nas abas ao carregar a página:

$(function(){
        if(window.location.hash != '') {
            $(`.nav-link[href="${window.location.hash}"]`).click();
        }
    });


Revision #1
Created 9 June 2025 16:56:24 by Everton
Updated 9 June 2025 16:58:43 by Everton