From 5ce94e69b311428d9d2f9b5502c02d3b960e380e Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 31 Oct 2017 09:59:26 -0700 Subject: Add useful error when duplicate web3 is detected. Fixes #2507 --- app/scripts/inpage.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/scripts') diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index b6889b00f..9261e7d64 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -31,6 +31,13 @@ var inpageProvider = new MetamaskInpageProvider(metamaskStream) // setup web3 // +if (typeof window.web3 !== 'undefined') { + throw new Error(`MetaMask detected another web3. + MetaMask will not work reliably with another web3 extension. + This usually happens if you have two MetaMasks installed, + or MetaMask and another web3 extension. Please remove one + and try again.`) +} var web3 = new Web3(inpageProvider) web3.setProvider = function () { log.debug('MetaMask - overrode web3.setProvider') -- cgit v1.2.3