extension-provider icon indicating copy to clipboard operation
extension-provider copied to clipboard

I want to be able to connect to meta mask browser extension from a chrome extension tab loaded application

Open javaspeak opened this issue 2 years ago • 0 comments

Greetings

I want to be able to connect to meta mask browser extension from a chrome extension tab loaded application.

However when I use a background script of the chrome extension to open my own extension app in a tab, it does not have access to the chrome namespace. The chrome variable is undefined.

i.e. in https://github.com/MetaMask/extension-provider/blob/master/index.js

this code will fail:

const metamaskPort = chrome.runtime.connect(currentMetaMaskId)

What I want to do is connect my wallet to the tab extension url which looks like this:

chrome-extension://oahhaapnfpkfnbgeopliehfgenifngde/tab.html#/register

i.e. I want the wallet connected to the chrome extension app and not the domain the content script happens to be on.

Thank you for your time

javaspeak avatar Oct 05 '23 06:10 javaspeak