geoenvi
asked on
window.location.port not working?
If I have the following in the HTML page thispage.htm
<body>
<script language=Javascript>
alert(window.location.host name); //or (use .host)
alert(window.location.port );
</script>
</body>
and I go to http://222.222.222.222:80/thispage.htm
first alert I get is fine
222.222.222.222
second one comes up blank. Why?
Is it some sort of a firewall config.
Can someone else share a snippet that actually gets the :80 (or any other) port number into a variable?
Thanks
<body>
<script language=Javascript>
alert(window.location.host
alert(window.location.port
</script>
</body>
and I go to http://222.222.222.222:80/thispage.htm
first alert I get is fine
222.222.222.222
second one comes up blank. Why?
Is it some sort of a firewall config.
Can someone else share a snippet that actually gets the :80 (or any other) port number into a variable?
Thanks
ASKER
I thought the location object contains what is typed in the URL addressbar of IE? I browse to http://222.222.222.222:80/thispage.htm and it clearly contains port number there
I just tested on my IIS. You are right, it is strange. The port was not passed neither to href nor to port!
ASKER
My point exactly. So.. what is the solution
:0)
:0)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
meaning that any port other than 80 would be passed into the location.port?
Yeap!
Or any port other then 443 for https.
ASKER
Do you know if this is an IIS specific trait or is it IE specific or what?
ASKER
Thanks Zvonko. You have helped a lot in the recent past. You can truly wear your your expert badge of honor
:-)
:-)
Thanks :-)
This worked also for port 80 on ASP side:
<% Response.Write("Port: " & Request.ServerVariables("S ERVER_PORT ")) %>
And I do not know how general that port problem is.
I can imagine that the normlization is done on browser side, because there is the scripting engine environment.
This worked also for port 80 on ASP side:
<% Response.Write("Port: " & Request.ServerVariables("S
And I do not know how general that port problem is.
I can imagine that the normlization is done on browser side, because there is the scripting engine environment.
Have a look at the complete location.href