MetaMask / MetaMask/metamask-mobile

Does Metamask mobile supports only Single Page DApps?

Open
#3,470 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
3k
Forks
1.7k
Avg merge
1d 14h
Merged PRs (30d)
669

Description

I'm building a Multi Page DApp (Web3) which has multiple pages. Not a React App, custom built using vanilla js and jquery.
A 'button' with the text 'Connect' is replaced with the last 4 characters of their wallet address after successfully connecting. I detect this connection every time the user refreshes the page or goes to another page using web3.eth.getAccounts(). This means that which ever page the user go (e.g. mydapp.com/swap, mydapp.com/stake, mydapp.com/exchange etc.), the connect button will keep displaying the last 4 characters of their wallet address.
Everything works as expected when using a browser (Chrome, Kiwi Browser) with Metamask extension.

But it doesn't seem to work when using the in app browser of Metamask Mobile. Upon successful connection of wallet, the last 4 characters of the address is displayed in the connect button (works as expected), but when refreshing the page or browsing to another page, this connection does not remain which means that the connect button reverts back to the text 'Connect' instead of displaying the last 4 characters of their wallet address, so the user will have to click 'Connect' button again but this time, an undefined error will appear. The error specifically says 'cannot read property 'eth' of undefined'.

So I'm thinking that this is working only on Single Page Applications. Is this true? or something is just wrong with my code? I hope anyone can give insights.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file, test, or entry point is named. Start by reproducing the report in MetaMask Mobile’s in-app browser with a multi-page vanilla JavaScript/jQuery DApp, checking refresh/navigation and the reported undefined web3 error. Done means establishing whether session persistence across pages is supported and, if it is, identifying a reproducible fix or documenting the limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
blockchain, mobile-dev, web-dev
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.