Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web3 HttpProvider not works on Safari (Iphone, IOS 11.4.1) #2071

Closed
pavlovdog opened this issue Nov 27, 2018 · 6 comments
Closed

Web3 HttpProvider not works on Safari (Iphone, IOS 11.4.1) #2071

pavlovdog opened this issue Nov 27, 2018 · 6 comments
Labels
Bug Addressing a bug

Comments

@pavlovdog
Copy link

pavlovdog commented Nov 27, 2018

I've written a simple project which uses the Web3JS on the client-side with Infura endpoint. Everything works great on my Chrome / Firefox:

How web3 works?
**Block number: 6779330**

But when I'm trying to run the page on my Iphone's Safari - nothing happens:

How web3 works?
**Block number: 0**

Here's a simple JSfiddle for illustrating the problem. For some reason, the web3.eth.blockNumber can't be loaded from the web3 instance.

@jpantunes
Copy link

jpantunes commented Nov 27, 2018

I had a look at your code and I think the issue is in the HttpProvider declaration, it should be composed on INFURA_HOST (e.g.: "https://mainnet.infura.io") + INFURA_PATH (e.g.: "/3567d988f7534c92bd2c0d42601a097a"). Removing the "v3" from the URI and running your code works.

Web3.providers.HttpProvider("https://mainnet.infura.io/v3/3567d988f7534c92bd2c0d42601a097a"));

@nivida nivida added the Needs Clarification Requires additional input label Nov 28, 2018
@pavlovdog
Copy link
Author

@jpantunes thanks for your answer! But it doesn't help :/ The result is the same: if you're running this fiddle (even with changed Infura path) at desktop Chrome - it works. If you're running it on the Iphone's Safari - the web3.eth.blockNumber is equal to 0 every time.

@jpantunes
Copy link

jpantunes commented Nov 28, 2018

@pavlovdog do you have Metamask installed in your desktop Chrome? This injects the web3 library into the jsfiddle and makes the code work.

I tried with Safari and could reproduce your problem and then tried in a new Chrome install (without Metamask) and had the same behaviour. Finally in Chrome with Metamask and Brave your code works fine.

@nivida nivida added this to the 1.0 milestone Nov 30, 2018
@pavlovdog
Copy link
Author

@jpantunes yeah, I've it installed, but I don't think that it matters. First of all, I've tried to run the Fiddle inside the private mode (MetaMask disabled) - it works. After that, I've tried to run the Fiddle inside Opera (MetaMask not installed at all) - also works fine.

@jpantunes
Copy link

@pavlovdog, so how are you loading the web3 library into the jsfiddle page without metamask?

It's my understanding that Opera has a builtin wallet with a web3 provider (https://blogs.opera.com/mobile/2018/07/opera-launches-first-browser-with-built-in-crypto-wallet/) so that might be why it works but I haven't tried it myself. I'm at a loss why would Chrome work with the extension disabled so my apologies if I couldn't help.

@nivida
Copy link
Contributor

nivida commented Mar 25, 2019

This got fixed with PR #2564 and will be released this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

3 participants