Bug 51439 - window.location.hostname should remove brackets of IPv6 host
Summary: window.location.hostname should remove brackets of IPv6 host
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.6
: P2 Normal
Assignee: Nobody
URL: http://[2001:240:629::6]/foo.html
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-21 18:03 PST by NARUSE, Yui
Modified: 2023-08-23 07:55 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description NARUSE, Yui 2010-12-21 18:03:31 PST
For IPv6 address, URI will be like http://[2001:240:629::6]/foo.html.
On IE and Firefox, when open the URI, window.location.hostname will be "2001:240:629::6".
But Safari 5.0.3 (6533.19.4) and Chrome 10.0.612.3 returns "[2001:240:629::6]".

Mozilla explicitly says remove brackets from hostname.
https://developer.mozilla.org/en/window.location

I think, it is because hostname means DNS name.

HTML5 doesn't say about this yet.
http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#dom-uda-hostname
Comment 1 Rob Buis 2020-07-05 04:02:03 PDT
The url spec went with adding the brackets:
https://url.spec.whatwg.org/#concept-host-serializer
So I think this bug report is invalid these days.
Comment 3 Anne van Kesteren 2023-08-23 07:55:12 PDT
Indeed.