You don't know why you want to do this, but you can do this by moving the href attribute to data-href , then remove href and add a click handler. Onclick will read data-href and redirect.
Demo
var links = document.getElementsByTagName("a"); for(var i=0; i<links.length; i++){ links[i].setAttribute("data-href", links[i].getAttribute("href")); links[i].removeAttribute("href"); links[i].onclick = function(){ window.location = this.getAttribute("data-href"); }; }
The menu of the right mouse button displays:

Mrcode
source share