location origin js example
<!DOCTYPE html>
<html lang="en">
<head>
<title>DOM Location Origin Property</title>
</head>
<body>
<h1 style="color: green">GeeksforGeeks</h1>
<b>DOM Location Origin Property</b>
<p>
Click on the button to get the location
origin of the page:
</p>
<button onclick="getOrigin();">
Get Location Origin
</button>
<p>The location origin of this page is:</p>
<div class="location"></div>
<script>
function getOrigin() {
let loc = location.origin;
document.querySelector('.location')
.innerHTML = loc;
}
</script>
</body>
</html>