Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get a Server Name in a Javascript file

Status
Not open for further replies.

Shift838

IS-IT--Management
Jan 27, 2003
987
US
I need to know how to run a java script and need entire code to get a server name display on the screen.
 
I need a new roof on my house. Do you know anyone that would be willing to do it for me?

Since Javascript runs on the client browser I am doubtful you could get it to query a server for it's name.

However you may be able to solve the problem with a little lateral thinking.

Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
You can get the domain name that the page is from but I don't think that's what your after is it?

Code:
script type="text/javaScript">
    window.onload=function(){
      alert(top.location.host);
    }
</script>

Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top