metaspartan / explorer

Ethereum Block Explorer (ETHExplorer V2) - Realtime Price Ticker, Shapeshift.io Integration, etc. (Project is currently not under active development, if you have a bug fix, please open a PR) My current project can be found at https://github.com/metaspartan/denarius (D a better cryptocurrency than ETH)
Other
486 stars 330 forks source link

Google browser console "web3 is not defined" #60

Open T-MacFbMa opened 5 years ago

T-MacFbMa commented 5 years ago

Google browser console "web3 is not defined”,It has been bothering me for a long time. Please tell me how to solve it. I have been trying to solve this problem,Looking forward to your reply!

maq128 commented 5 years ago

At line 103 of file app/app.js, there is a statement window.web3 = web3; with condition if (window.web3), comment out the condition line, then there would be always a defined web3. I'm not sure whether this is the correct solution, it just works for me.

Amidama commented 5 years ago

in app/app.js you add

if (typeof web3 !== 'undefined') { web3 = new Web3(web3.currentProvider); } else { // set the provider you want from Web3.providers web3 = new Web3(new Web3.providers.HttpProvider("http://"+GETH_HOSTNAME+":"+GETH_RPCPORT); }

and delete var Web3 = require('web3');

sthnaqvi commented 5 years ago

Use this https://github.com/sthnaqvi/explorer