Index: chrome/browser/resources/synthetic_middleclick.js |
diff --git a/chrome/browser/resources/ntp4/synthetic_middleclick.js b/chrome/browser/resources/synthetic_middleclick.js |
similarity index 70% |
rename from chrome/browser/resources/ntp4/synthetic_middleclick.js |
rename to chrome/browser/resources/synthetic_middleclick.js |
index 8c90c98a7f5abab97c059ede25c5e2a1345170b4..2045d3facf5c659f45e72efaad4768adfb51e65c 100644 |
--- a/chrome/browser/resources/ntp4/synthetic_middleclick.js |
+++ b/chrome/browser/resources/synthetic_middleclick.js |
@@ -21,4 +21,12 @@ document.addEventListener('mouseup', function(e) { |
middleButtonMouseDownTarget = null; |
}, true); |
+// Prevent the synthetic click to open a new tab as the new tab will |
+// open if the click happened on a link regardless of this synthetic |
+// event. |
Dan Beam
2016/05/31 21:34:32
i don't understand what this comment means. can y
Navid Zolghadr
2016/06/01 18:46:16
How about this?
|
+window.addEventListener('click', function(e) { |
+ if (e.button == 1 && !e.isTrusted) |
Dan Beam
2016/05/31 21:34:32
don't we control the code that's doing this? why
Navid Zolghadr
2016/06/01 18:46:16
Maybe the new comment explains this a little bette
|
+ e.preventDefault(); |
+}); |
+ |
})(); |