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 |
index cf3a2991ed644ed2418b24028d3b15d046c37470..32fff927f8e80fe94fee0fc0c711ce42554a484f 100644 |
--- a/go-back-with-backspace/content_script.js |
+++ b/go-back-with-backspace/content_script.js |
@@ -1,8 +1,12 @@ |
-// Listen for the backspace key and go back if not in an editable field. |
+// Listen for shift-backspace or unmodified backspace and navigate if not in |
+// an editable field. |
document.addEventListener('keydown', function(e) { |
- if (e.which === 8 && // backspace key code |
+ if (e.key === 'Backspace' && |
+ !e.altKey && |
+ !e.ctrlKey && |
+ !e.metaKey && |
!isEditable(e.path)) { |
- window.history.back(); |
+ e.shiftKey ? window.history.forward(): window.history.back(); |
e.preventDefault(); |
} |
}); |