js URL code example
Example 1: javascript get current url
var currentUrl = window.location.href;
Example 2: javascript get domain
window.location.hostname
Example 3: javascript url
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript</h2>
<h3>The window.location object</h3>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
"The full URL of this page is:<br>" + window.location.href;
</script>
</body>
</html>
Example 4: how to get url node
const https = require("https");
const url = https://url.com
app.get("/", function(req, res){
https.get(url, function(res){
console.log(res);
});