-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
MetaMask Browser extension not detected #664
Comments
Hi, in the recording there is no extension installed, that's why the connection is made with MM SDK. Which browser are you using? Also, the pure javascript minified file needs to be updated with the latest version of the MM SDK and we'll do it in a very few days. Thanks for reporting this. |
Closing due to no further response. |
I have the same problem, please help! package.json {
"name": "@metamask/sdk-pure-javascript-example",
"version": "1.0.0",
"private": true,
"description": "An example use of the MetaMask SDK on pure-javascript",
"repository": {
"type": "git",
"url": "https://github.com/MetaMask/sdk.git"
},
"license": "ISC",
"main": "src/index.js",
"files": [
"dist/"
],
"scripts": {
"start": "serve .",
"allow-scripts": "echo 'n/a'"
},
"dependencies": {
"@metamask/sdk": "^0.18.5",
"serve": "13.0.2"
}
} My helloworld html <!doctype html>
<html>
<head>
<script src="node_modules/@metamask/sdk/dist/browser/iife/metamask-sdk.js"></script>
<script>
const sdk = new MetaMaskSDK.MetaMaskSDK({
dappMetadata: {
name: "Pure JS example",
url: window.location.host,
},
logging: {
sdk: true,
}
});
</script>
<script>
let provider;
function connect() {
console.log('connect button clicked')
sdk.connect()
.then((res) => {
console.log('sdk.connect.then')
provider = sdk.getProvider();
console.log(provider.isMetaMask)
})
.catch((e) => console.log('request accounts ERR', e));
}
function addEthereumChain() {
provider
.request({
method: 'wallet_addEthereumChain',
params: [
{
chainId: '0x89',
chainName: 'Polygon',
blockExplorerUrls: ['https://polygonscan.com'],
nativeCurrency: { symbol: 'MATIC', decimals: 18 },
rpcUrls: ['https://polygon-rpc.com/'],
},
],
})
.then((res) => console.log('add', res))
.catch((e) => console.log('ADD ERR', e));
}
</script>
</head>
<body>
<button onclick="connect()">Connect</button>
<button onclick="addEthereumChain()">ADD ETHEREUM CHAIN</button>
</body>
</html> I've tried different browsers: Firefox Chromium and Brave. All failed to detect Metamask extesion. |
Hi @jimgreen2013, can you post this issue in https://github.com/metamask/metamask-sdk? |
Sure |
I have tried using the
pure JS
implementation of the providedguide
=> https://c0f4f41c-2f55-4863-921b-sdk-docs.github.io/guide/metamask-sdk-js/metamask-sdk-pure-javascript.htmlWorks all well on my
mobile
device to open the targetMetaMask
application, however, on the browser, it does not seem to detect myMetaMask
already installed extension... Is this meant to be like this ? I have noticed that on thehttps://recordit.co/g9u0X2S60Z
link, the use of theBrowser Extension
is not shown, only via theQR-Code
Signing...The text was updated successfully, but these errors were encountered: