GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc,url: fix url.hostname example · nodejs/node@8fdf077

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • url.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/url.md‎

Copy file name to clipboardExpand all lines: doc/api/url.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,15 @@ const myURL = new URL('https://example.org:81/foo');
210210
console.log(myURL.hostname);
211211
// Prints example.org
212212

213+
// Setting the hostname does not change the port
213214
myURL.hostname = 'example.com:82';
214215
console.log(myURL.href);
215216
// 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
216222
```
217223

218224
Invalid host name values assigned to the `hostname` property are ignored.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.