根据这个网站:
https://developers.tron.network/docs/tronlink-integration
我想能够按照以下代码将任何网站连接到 TronWeb:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<button onclick="gettronweb()">Can you get tronweb from tronlink?</button>
<script>
function gettronweb(){
if(window.tronWeb && window.tronWeb.defaultAddress.base58){
document.write("Yes, catch it:",window.tronWeb.defaultAddress.base58)
}
}
</script>
</body>
</html>
但是,当我尝试这样做时,这不起作用,有人可以解释为什么吗?
我安装了 tronlink(Chrome 扩展程序),它适用于所有其他网站,所以这不是问题。
还是我错过了什么?