Click to reload without query string

Code used:

            
                <a href="#" id="reload"p>Click to reload without query string</ap>

                    <scriptp>
                    document.getElementById("reload").onclick = function() {reload()};

                    function reload() {
                        window.location = window.location.href.split("?")[0];
                    }
                </scriptp>