MetaMask / MetaMask/metamask-mobile

window.ethereum undefined on mobile?

Open
#3,503 9 comments 5 reactions 0 assignees View on GitHub
community dapp-compatibility
Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

I built a web application calling metamask with code such as this one:

```
await window.ethereum.request({
method: 'wallet_switchEthereumChain',
params: [{ chainId: chainId }],
});
```
But on mobile, android chrome, window.ethereum is undefined, despit metamask being installed.
On desktop everything work as expected, any idea what could be the reason?

Do we have to do something special for mobile?

Contributor guide

Open the contributing guide

Research direction

No repository files or tests are named. Start by reproducing the report in Android Chrome with MetaMask installed, comparing whether window.ethereum is present on mobile and desktop; done means the cause and the required mobile behavior are identified and covered by an appropriate fix or documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
api, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.