Skip to content

Instantly share code, notes, and snippets.

@rishoej
Created September 18, 2018 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rishoej/5ba85a75e80fa07ba5fee47ec762e1d0 to your computer and use it in GitHub Desktop.
Save rishoej/5ba85a75e80fa07ba5fee47ec762e1d0 to your computer and use it in GitHub Desktop.
Monkey patch window.location.origin with typescript
if (!window.location.origin) {
// window.location.origin is "readonly", not sure how to overwrite that so use any type for this.
const wl: any = window.location
const port = wl.port ? `:${wl.port}` : ''
wl.origin = `${wl.protocol}//${wl.hostname}${port}`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment