HTML DOM Base href attribute
Definition and Usage
href property sets or returns a reference page URL for all links.
grammar
baseObject.href=URL
Browser Support
All major browsers support href attribute
Examples
Examples
The following example returns the base URL of the page ::
<html>
<head>
<base id="htmldom" href="http://www.w3cschool.cc/jsref/">
</head>
<body>
<p>Base URL is:
<script>
document.write(document.getElementById("htmldom").href);
</script>
</p>
</body>
</html>
<head>
<base id="htmldom" href="http://www.w3cschool.cc/jsref/">
</head>
<body>
<p>Base URL is:
<script>
document.write(document.getElementById("htmldom").href);
</script>
</p>
</body>
</html>
Examples of the above output:
Base URL is: http://www.w3cschool.cc/jsref/
try it"
Base Object