The DOM Location origin Property in HTML is used to return the protocol, hostname and port number of a URL. This is a read-only property.
Return Value: This method returns a String value representing the protocol, the domain name (or IP address) and port number. The URL’s having the ‘file://’ protocol may return different values depending on the browser.
Note: Some browsers may not display the port number.
Below examples illustrate the above method:
- Before clicking the button:
- After clicking the button:
Supported Browsers: The browser supported by DOM Location origin property are listed below:
- Google Chrome
- Internet Explorer 11.0
- Opera 15.0
- HTML | DOM Area origin Property
- HTML | DOM Anchor origin Property
- HTML | DOM KeyboardEvent location Property
- HTML | DOM Location href Property
- HTML | DOM Location protocol Property
- HTML | DOM Location pathname Property
- HTML | DOM Location port Property
- HTML | DOM Location host Property
- HTML | DOM Location hash Property
- HTML | DOM Location hostname Property
- HTML | DOM Location Search Property
- CSS | transform-origin Property
- CSS | background-origin property
- CSS perspective-origin Property
- HTML | Location assign( ) Method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.