Index: go-back-with-backspace/content_script.js |
diff --git a/go-back-with-backspace/content_script.js b/go-back-with-backspace/content_script.js |
new file mode 100755 |
index 0000000000000000000000000000000000000000..cf3a2991ed644ed2418b24028d3b15d046c37470 |
--- /dev/null |
+++ b/go-back-with-backspace/content_script.js |
@@ -0,0 +1,8 @@ |
+// Listen for the backspace key and go back if not in an editable field. |
+document.addEventListener('keydown', function(e) { |
+ if (e.which === 8 && // backspace key code |
+ !isEditable(e.path)) { |
+ window.history.back(); |
+ e.preventDefault(); |
+ } |
+}); |