Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect if Metamask is installed #4998

Closed
JaceHensley opened this issue Aug 8, 2018 · 3 comments
Closed

Detect if Metamask is installed #4998

JaceHensley opened this issue Aug 8, 2018 · 3 comments

Comments

@JaceHensley
Copy link

Since web3 will no longer be injected by the extension there isn't really a way to detect if Metamask is installed.

What would be the best way of detecting if the extension is installed or not going forward?

@bdresser
Copy link
Contributor

bdresser commented Aug 8, 2018

hey @JaceHensley - you're right, and that's sort of the point. But this definitely poses some interesting UX challenges. There's an open discussion on Ethereum Magicians on the same topic here. From that thread:

Feature detection is impossible, and so Dapps will need to present some kind of open-ended log-in button that both tries to log on and suggests installing a web3 browser if the user doesn’t have one yet.

Suggestions for a smooth UX are welcome! We're working on this on our end as well, feel free to check out our proposed implementation here.

@JaceHensley
Copy link
Author

JaceHensley commented Aug 8, 2018

So our flow currently allows detection of install while the user remains on our dapp's signin page. What we do is inject an iframe that refreshes until it detects web3 (since extensions can't inject into already loaded pages). This allows the user to come to our site without MM installed and either be instructed to install MM or continue. And the page only refreshes once the iframe has detected a web3 instance.

We can't really do the same thing with the new request because we wouldn't really want to request from an iframe.

My suggestion would be just a simple window.isMetamaskInstalled or something like that. This would still not give the site access to an ethereum until they request and the user accepts it. But it would help determine if the site should request access or instruct the user to install MM right off the bat.

This would improve UX as well since we wouldn't be waiting to determine if the user accepted/declined or if they don't have MM installed.

Edit: Or maybe some kinda userAgent string that can be more general and used by other dapp browsers


I do really like that UX shown here!

@bdresser
Copy link
Contributor

bdresser commented Aug 9, 2018

Part of the purpose of EIP 1102 is to prevent sites from knowing if the user has any sort of web3 extension installed. Even this basic info can be used to identify the user's browser fingerprint.

We're aware that adding this layer of privacy makes for a more open-ended experience, where you're not sure whether the user doesn't have MetaMask or if they're just slow. Still, we think this is a necessary step to protect users.

We plan to release a couple tools/components to show the interaction with the postMessage API and demonstrate what we think makes sense for good UX. In general, I think it will be palatable to most users if your dapp says something like "Connect with your web3 browser. If you don't have one, get one!"

If it's okay with you, let's keep this discussion on the Ethereum magicians thread where more folks will see it. (cc @bitpshr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants