Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Tests if the scripts is running in local (taken from registerServiceWorker.js - CRA apps)
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// is considered localhost for IPv4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.