Skip to content

Instantly share code, notes, and snippets.

@mrshawnspencer
Created October 21, 2019 14:58
Show Gist options
  • Save mrshawnspencer/e7cf4f3793de057f006b939a05133a9d to your computer and use it in GitHub Desktop.
Save mrshawnspencer/e7cf4f3793de057f006b939a05133a9d to your computer and use it in GitHub Desktop.
// Just get the hostname of the URL
// Example: https://electmyhealthplan.org/find-a-doctor
// Result: electmyhealthplan
// Test this in the browser console:
// var hostname = window.location.hostname.split('.')[0]; console.log(hostname);
var hostname = window.location.hostname.split('.')[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment