1
rated 0 times
[
3]
[
2]
/ answers: 1 / hits: 17045
/ 12 Years ago, sat, december 22, 2012, 12:00:00
I try to get only the domain name i.e. google.com
from javascript
document.location.hostname
This code returns www.google.com
.
How can I only get google.com
? In this case it would be to either remove the www.
or get only the domain name (if there's such a method in javascript).
More From » javascript