How to show the full URL of a document with JavaScript?

HTMLJavascriptProgramming Scripts

To get the URL of a document, use the JavaScript URL property. You can try to run the following code to display full URL of a document with JavaScript −

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>JavaScript Example</title>
   </head>
   <body>
      <script>
         var str = document.URL;
         document.write("URL: "+str);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 08:14:06
Advertisements