Answers for "get hostname javascript"

37

javascript get current url

var currentUrl = window.location.href;
Posted by: Guest on July-22-2019
0

js get hostname from url

url = "http://www.example.com/path/to/somwhere";
urlParts = /^(?:\w+\:\/\/)?([^\/]+)([^\?]*)\??(.*)$/.exec(url);
hostname = urlParts[1]; // www.example.com
path = urlParts[2]; // /path/to/somwhere
Posted by: Guest on April-09-2021
0

get hostname

socket.gethostbyname(socket.gethostname())
Posted by: Guest on September-18-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language