kai.infotren/common/back.js

16 lines
436 B
JavaScript
Raw Normal View History

2022-07-13 00:33:59 +03:00
window.addEventListener('load', function (e) {
document.body.addEventListener('keydown', function (e) {
2022-07-13 01:24:00 +03:00
if (e.key == 'Backspace' && (e.target.tagName.toUpperCase() !== 'INPUT' || e.target.value.length === 0)) {
2022-07-13 00:33:59 +03:00
e.preventDefault()
window.history.back()
}
})
var backButton = document.getElementById('back-button')
if (backButton) {
backButton.addEventListener('click', function (e) {
window.history.back()
})
}
2022-07-13 00:33:59 +03:00
})