Anchor tags not working in chrome when using #

Turns out this was a bug in certain versions of chrome, posting workaround for anyone who needs it! 🙂

$(document).ready(function () {
        var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
        if (window.location.hash && isChrome) {
            setTimeout(function () {
                var hash = window.location.hash;
                window.location.hash = "";
                window.location.hash = hash;
            }, 300);
        }
    });

Leave a Comment