Safari Mojave – Enable Backspace to Go Back

mojavesafari

There are other questions and answers about how to enable the key Backspace to go back to the previous page in Safari, but none of them work on my newly installed Mojave even though it used to work on High Sierra.

How can I enable this behaviour in Mojave?

Best Answer

You can add a keyboard shortcut from the terminal, but this requires you to disable system integrity in macOS 10.14 Mojave and later.

defaults write com.apple.Safari NSUserKeyEquivalents -dict-add Back "\U232b"

Alternative, you can install a Safari Extension which injects a script that bring back the functionality:

https://github.com/yene/Safari-Backspace

For example:

document.addEventListener("DOMContentLoaded", function(event) {
    function handleBackspace(e) {
        if (e.keyCode === 8 && !e.ctrlKey && !e.shiftKey
            && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA'
            && e.target.contentEditable !== 'true' // TinyMCE
            ) {
            e.preventDefault();
            window.history.go(-1);
        }
    }
    window.addEventListener('keydown', handleBackspace, false);
});