FIX: location.pathname Incorrectly Returns Port Number (183490)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 4.0
- Microsoft Internet Explorer (Programming) 4.01
This article was previously published under Q183490 SYMPTOMS
The location.pathname property returns a string that incorrectly has the
port number appended. This only occurs when used on a page hosted on a Web
server port other than 80 or 8080.
For example, location.pathname on a document with the URL
"http://testserver:81/stuff/page.htm" incorrectly returns the string "/:81/stuff/page.htm".
RESOLUTION
Look for the existence of the port number in the location.pathname string,
and if it exists, remove it. Here is sample code that demonstrates a
possible workaround:
<SCRIPT LANGUAGE="VBScript">
locPath = location.pathname
cchColon = InStr(LocPath, ":")
if (cchColon > 0) then
cchRealPathStart = InStr(cchColon, locPath, "/")
if (cchRealPathStart > 0) Then
locPath = mid(locPath, cchRealPathStart, Len(locPath))
end if
end if
</SCRIPT>
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in Microsoft Internet Explorer 5.
Modification Type: | Major | Last Reviewed: | 10/15/2002 |
---|
Keywords: | kbBug kbie500fix KB183490 |
---|
|