Page 1 of 1

window.location.host

Posted: Mon Feb 05, 2007 1:52 pm
by moiseszaragoza
I was wandering if i can get the host name of a web address that i am going to


for example

Code: Select all

var=http://www.mysite.com/pages/thispage.php

 newVar= window.location.host (var); 
window.alert(newVar) // http://www.mysite.com/
Thanks

Posted: Mon Feb 05, 2007 3:16 pm
by Christopher
I think it would be just

window.alert(window.location.host)

Posted: Mon Feb 05, 2007 3:39 pm
by moiseszaragoza
Thanks

Posted: Mon Feb 05, 2007 3:46 pm
by DaveTheAve
ha ha.... [url]javascript:window.alert(window.location.host);[/url] ... sorry I had too.