trust-web3-provider icon indicating copy to clipboard operation
trust-web3-provider copied to clipboard

Make web3 provider available to iframe

Open eltNEG opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

Currently, web3 provider is not available for iframes.

Describe the solution you'd like I'd like web3 provider to be available for iframes to connect to - just like it is available with metamask browser extension

Describe alternatives you've considered An alternative (and the current walk around I am using) is to use the browser's postMessage to communicate with a script on the parent website. Making web3 provider available to iframes is far better than this approach.

Additional context I think metamask is working on bringing back the feature to their mobile wallet: https://github.com/MetaMask/metamask-mobile/issues/3417

eltNEG avatar Dec 22 '21 21:12 eltNEG

Good

arslan-raza-143 avatar Dec 23 '21 00:12 arslan-raza-143

@eltNEG Can I ask for some more detail on how you are using postMessage?

tradephonic avatar Feb 08 '22 12:02 tradephonic

@eltNEG Can I ask for some more detail on how you are using postMessage?

@tradephonic Check the links below

https://github.com/sftwr-prjct-dev/web3libjs/blob/master/web3api/evWeb3api.ts

https://github.com/sftwr-prjct-dev/web3libjs/blob/afcb58ef7b60bcbf1a9756e4bab43b9c5808360e/public/widgets/swap.js#L69

eltNEG avatar Feb 08 '22 13:02 eltNEG

@eltNEG Can I ask for some more detail on how you are using postMessage?

@tradephonic Check the links below

https://github.com/sftwr-prjct-dev/web3libjs/blob/master/web3api/evWeb3api.ts

https://github.com/sftwr-prjct-dev/web3libjs/blob/afcb58ef7b60bcbf1a9756e4bab43b9c5808360e/public/widgets/swap.js#L69

Thanks !

tradephonic avatar Feb 08 '22 14:02 tradephonic

I try to use iframe.contentWindow.self.web3 = window.web3 iframe.contentWindow.self.ethereum = window.ethereum resolve iframe in metamask bug Guys can try it. thanks.

domingoace avatar Apr 14 '22 06:04 domingoace

Hey! Is there any update on supporting dApps loaded in iframes?

balint-front avatar Mar 25 '24 14:03 balint-front