Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<base id="myBase" href="/jsref/">
</head>
<body>
<a href="default.asp">Default</a>
<p>Click the button to change the value of the href attribute of the base element.</p>
<p>Try the link before and after you click the button.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("myBase").href = "/html/";
  document.getElementById("demo").innerHTML = "Base URL was changed from /jsref/ to /html/.";
}
</script>
</body>
</html>