FIX: location.pathname Incorrectly Returns Port NumberID: Q183490
|
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".
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>
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Internet Explorer 5.
Additional query words:
Keywords : kbIE400bug kbIE401bug kbIE500fix
Version : WINDOWS:4.0,4.01
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 8, 1999