Answers for "get subdomain from url javascript"

0

get subdomain from url javascript

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

Code answers related to "get subdomain from url javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language