
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM URL Property
The HTML DOM URL property returns a string corresponding to the url of the document.
Following is the syntax −
Returning string value
document.URL
Let us see an example of HTML DOM URL property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM URL</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-URL</legend> <h2 >This is a Demo Example</h2> <input type="button" value="Get Link" onclick="getLink()"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); function getLink() { divDisplay.textContent = document.URL; } </script> </body> </html>
Output
Before clicking ‘Get Link’ button −
After clicking ‘Get Link’ button −
- Related Articles
- HTML DOM Input URL autocomplete Property
- HTML DOM Input URL autofocus Property
- HTML DOM Input URL defaultValue Property
- HTML DOM Input URL disabled Property
- HTML DOM Input URL form Property
- HTML DOM Input URL maxLength Property
- HTML DOM Input URL name Property
- HTML DOM Input URL pattern Property
- HTML DOM Input URL placeholder Property
- HTML DOM Input URL readOnly Property
- HTML DOM Input URL required Property
- HTML DOM Input URL size Property
- HTML DOM Input URL type Property
- HTML DOM Input URL value Property
- HTML DOM Input URL Object

Advertisements