Skip to content

Instantly share code, notes, and snippets.

@lgarron
Created December 22, 2020 00:03
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 lgarron/8f5c968f28fcbfb85291f4bb52383a38 to your computer and use it in GitHub Desktop.
Save lgarron/8f5c968f28fcbfb85291f4bb52383a38 to your computer and use it in GitHub Desktop.
<domain-name>
<!DOCTYPE html>
<html>
<script type="module">
class DomainNameElement extends HTMLElement {
connectedCallback() {
this.textContent = (new URL(location.href)).hostname
}
}
customElements.define('domain-name', DomainNameElement);
</script>
<domain-name></domain-name>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment