I would like to prevent an HTML button that acts like a link take you to the same page from reload the page
For Example: prevent reload the website when click on logo if you are in Homepage.
How can I do this?
Full code: https://codepen.io/Muh-Ail/pen/oNpLKXM?editors=0010
let activeBtn = document.querySelector(".active-btn");
let currentLocation = location.href;
if (activeBtn.href === currentLocation) {
activeBtn.preventDefault();
}