trust-web3-provider
trust-web3-provider copied to clipboard
Make web3 provider available to iframe
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
Good
@eltNEG Can I ask for some more detail on how you are using postMessage?
@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 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 !
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.
Hey! Is there any update on supporting dApps loaded in iframes?