0

I'm running the development server on localhost:8000. Can document.domain include a port number, e.g., document.domain = 'localhost:8000'? I seem to be getting an error saying localhost:8000 cannot be parsed properly.

John M.
  • 2,642
  • 7
  • 26
  • 55

1 Answers1

2

No. The document.domain includes only the host name.

document.domain

Gets/sets the domain portion of the origin of the current document, as used by the same origin policy.

preview

Alternatively, location.port gets you the port of the domain.

Community
  • 1
  • 1
Soolie
  • 1,812
  • 9
  • 21