【发布时间】:2021-08-21 12:35:54
【问题描述】:
想为某些人显示合同信息,但不想使用元掩码-在使用元掩码和 web3 之前,它可以工作-现在希望当客户检查我们的网站时(html/java 脚本前端合同)他们从来没有安装元掩码,只需查看从合同加载的信息。请帮帮我。
在我使用此代码之前,但在其他浏览器中人们会看到以太坊的错误:
<script>
if (typeof window.ethereum !== 'undefined')
{
console.log('MetaMask is installed!');
}else{
console.log('MetaMask not installed!');
alert("Please install Metamsk wallet first, then try again");
}
const accounts = ethereum.request({ method: 'eth_requestAccounts' });
const account = accounts[0];
const showAccount = document.querySelector('.showAccount');
</script>
【问题讨论】:
标签: backend blockchain contract