I followed https://web3js.readthedocs.io/en/1.0/getting-started.html and downloaded web3.min.js to my http host. In my html I have:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="./web3.min.js"></script>
<script type="text/javascript" src="./libs/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function () {
console.log(Web3.givenProvider || web3.currentProvider);
web3 = new Web3(Web3.givenProvider || web3.currentProvider);
console.log('Version:', web3.version.api);
});
</script>
</head>
<body>
</body>
</html>
I visit the page and see version is 0.20.0
. Also from the API doc, if it were 1.0
then web3.version
should be 1.0
and there should be no member called .api
.
What am I doing wrong here that I'm getting 0.20.0
?
Chrome. Metamask 3.13.4. Downloaded web3.min.js
from https://raw.githubusercontent.com/ethereum/web3.js/1.0/dist/web3.min.js
EDIT
Also tried download web3.min.js
from the master
branch. Same result.
EDIT
Actually for the current 1.0
I'm getting Uncaught SyntaxError: Unexpected token <<
from the file as I look into browser's debug window.