Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to extract domain name of url of current page in javascript

var url = window.location.href;
var domain = url.replace('http://','').replace('https://','').split(/[/?#]/)[0];
Source by scratch99.com #
 
PREVIOUS NEXT
Tagged: #extract #domain #url #current #page #javascript
ADD COMMENT
Topic
Name
2+2 =