4

I have installed MetaMask extension for Chrome, then I saw ext icon at top toolbar. To login I will open it by click on the icon. There is a question...

Is there a way to launch MetaMask window by JavaScript? I want use my own Login button at web page to launch login screen.

MetaMask login

1 Answer 1

3

Chrome extension popups like this can only be opened by the user triggering it themselves, either by clicking on the icon or a keyboard shortcut.

You could use the ethereum.enable() call they've recently added to prompt the user though: https://medium.com/metamask/https-medium-com-metamask-breaking-change-injecting-web3-7722797916a8. This may provide the type of user experience you'd expect.

2
  • No problem. Would you mind marking the question as answered by this since it worked for you?
    – wbobeirne
    Commented Dec 3, 2018 at 3:41
  • This will be deprecated. Use this instead: await ethereum.request({ method: 'eth_requestAccounts' });
    – Russo
    Commented Oct 27, 2021 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.