Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM URL Property

  • Difficulty Level : Basic
  • Last Updated : 25 Jul, 2019

The URL property in HTML is used to return a string which contains the complete URL of the current document. The string also includes the HTTP protocol such as ( http://).



Below program illustrates the document.URL property in HTML:


<!DOCTYPE html>
        <title>DOM document.URL() Property</title
            h1 { 
            h2 {
                font-family: Impact;
            body { 
        <h2>DOM document.URL() Property</h2
        <p>For displaying the URL of the document, double 
        click the "View URL" button: </p>
        <button ondblclick="myURL()">View URL</button>
        <p id="url"></p>
            function myURL() {
                var gfg = document.URL;
                document.getElementById("url").innerHTML = gfg;


Supported Browsers: The browser supported by document.URL property are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Apple Safari

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :