I built a website and set up the web3 to interactive with my smart contract. Everything is fine on desktop but if i use Metamask browser visiting the website on mobile then i can't connect it to Metamask. Here's my web3 provider setting
I think there's something wrong on "web3.currentProvider" so that the function below "requestAccounts()" doesn't work.
What should i do to fix this problem?
Best Answer
You shouldn't be using
web3.currentProvider
anymore. This is the old way. Do this instead:See How to Connect Web3.js to MetaMask in 2021