We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 76b1863 commit a8dab21Copy full SHA for a8dab21
doc/api/url.md
@@ -210,9 +210,15 @@ const myURL = new URL('https://example.org:81/foo');
210
console.log(myURL.hostname);
211
// Prints example.org
212
213
+// Setting the hostname does not change the port
214
myURL.hostname = 'example.com:82';
215
console.log(myURL.href);
216
// Prints https://example.com:81/foo
217
+
218
+// Use, myURL.host to change the hostname and port
219
+myURL.host = 'example.org:82';
220
+console.log(myURL.href);
221
+// Prints https://example.org:82/foo
222
```
223
224
Invalid host name values assigned to the `hostname` property are ignored.
0 commit comments