website
Diffstat (limited to 'components/backbutton.js')
| -rw-r--r-- | components/backbutton.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/components/backbutton.js b/components/backbutton.js new file mode 100644 index 0000000..cc6bfa7 --- /dev/null +++ b/components/backbutton.js @@ -0,0 +1,27 @@ +customElements.define( + "back-button", + class extends HTMLElement { + constructor() { + super(); + } + connectedCallback() { + this.innerHTML = ` +<style> + .back_button { + position: fixed; + margin: 15px; + z-index: 100; + } +</style> + +<button class="button back_button" onclick="goBack()"> + <i class="fa-solid fa-caret-left"></i> back +</button>`; + } + } +); + +function goBack() { + if (typeof window.history.back() == "undefined") + window.location = "/index.html"; +} |