Skip to content
Related Articles

Related Articles

HTML | DOM Anchor origin Property

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 17 Oct, 2019

The Anchor origin property in HTML DOM is used to return the protocol, hostname and port number of the href attribute value. It is the readonly property that returns a string value which represents the protocol, domain name and the port number of the URL.



Below program illustrates the use of Anchor origin Property in HTML DOM:

Example: This example returns the anchor origin property.

<!DOCTYPE html>
        HTML DOM Anchor origin Property
        DOM Anchor origin Property
        <p>Welcome to
            <a href=
        <button onclick="myGeeks()">
        <p id="sudo"
            function myGeeks() {
                var x =
                "sudo").innerHTML = x;


Before Clicking On Button:

After Clicking On Button:

Supported Browsers: The browser supported by DOM Anchor origin property are listed below:

  • Google Chrome
  • Internet Explorer 10.0 +
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!