window.location.href प्रॉपर्टी
JavaScript के साथ वर्तमान URL प्राप्त करने के लिए, window.location.href प्रॉपर्टी का उपयोग करें:
उदाहरण
<!DOCTYPE html> <html>
<body>
<h3>Get current URL</h3>
<p id="test"></p>
<script>
document.getElementById("test").innerHTML = "URL of the page: " + window.location.href;
</script>
</body>
</html>