kai.infotren/common/back.js
Dan Cojocaru fd1e7c0729
Add back button
Also: change PWA to standalone
2022-11-18 04:58:35 +01:00

15 lines
436 B
JavaScript
Executable file

window.addEventListener('load', function (e) {
document.body.addEventListener('keydown', function (e) {
if (e.key == 'Backspace' && (e.target.tagName.toUpperCase() !== 'INPUT' || e.target.value.length === 0)) {
e.preventDefault()
window.history.back()
}
})
var backButton = document.getElementById('back-button')
if (backButton) {
backButton.addEventListener('click', function (e) {
window.history.back()
})
}
})