Non ethereum enabled browser - issue

I am going through the motions of creating my first dApp using Moralis, however I have hit a brick wall with an issue when using it on an iphone or ipad, which i don’t get when using it on my PC. I have tried it in both Safari and Chrome. The sign in to my wallet works fine but on actioning the function i just get Non ethereum enabled browser

I have googled lots of posts where others seem to see the same, but the proposed fixes don’t work for me.

I am coding the dApp in Visual Studio Code and have the Live Server and walletconnect extensions installed. I am using WIX to build a webpage for the dDapp where I copy in the html.

I have these pertinent sections in my html file:-

  let provider = 'metamask';
  let web3;function Login(){
    try {
      console.log("login clicked");
      let provider = 'walletconnect';
      var user = Moralis.Web3.authenticate({ provider: 'walletconnect',
      mobileLinks: [
      "metamask",
      "trust",
      ]});
      console.log("Logged in via walletconnect:", user);
    } catch (error) {
      console.log('Failed to login', error);
    }
  }

async function rungetPrice() {
try {
if(provider == ‘walletconnect’) {
web3 = await Moralis.enableWeb3({ provider: ‘walletconnect’ });
}
else {
web3 = await Moralis.enableWeb3();
}
const options = {
address: inpCN.value,
chain: “bsc”,
exchange: “PancakeSwapv2”
};
const price = await Moralis.Web3API.token.getTokenPrice(options);
console.log('Price: ', price)
} catch (error) {
console.log(‘Failed’, error);
}
}

I have also included

src=“https://github.com/WalletConnect/walletconnect-monorepo/releases/download/1.7.1/web3-provider.min.js”

within script tags

Have I something missing somewhere, another VSC extension perhaps or is there an issue with my code that causes this problem top manifest itself?

Thanks in anticipation.

you have to run it from deployed website that uses https for wallet connect to work

you can open the page in the internal browser that is included in metamask application if you don’t want to use walletconnect

I’m sure i have tried using the internal browser in MetaMask already but I will try it again.

Just tried from the internal metamask browser and still get
Non ethereum enabled browser
My website is also https too.

It must be something else

Your prowler works with MetaMask in a normal browser?

The dApp works fine on my PC from my website using chrome browser and a metamask chrome extension wallet.
But this doesn’t use walletconnect to connect, if that is what the issue is.
On an aside, even though I get the ‘Non ethereum enabled browser’ error message on my iPhone, Read only functions to a BSC smart contract do work and retrieve their data.

I think that it should work in the internal browser for MetaMask. Making it working with wallet connect is a different thing, you can make it work with wallet connect in desktop browser too.

How do you call the read functions that work?
You can call read only functions with web3api too where you also don’t need MetaMask.

I use:-
Moralis.Web3API.native.runContractFunction(options);
for read functions which works fine everywhere.

Both
Moralis.executeFunction(options);
and
Moralis.Web3API.token.getTokenPrice(options)
Throw up the error in both my iphone and ipad whether in chrome, safari or the metamask browser.
Although in the metamask browser I don’t get that far if I try to connect with walletconnect I get into an install metamask - open - back to walletconnect infinity loop. If I try to login direct I get the Non… error

Also, how does walletconnect work on a desktop browser? When I try it, it only brings up a handful of wallets, none of which are metamask

This is web3api and doesn’t need MetaMask.

In this case one is not web3api and one should work without problems.

You could try to make it work with MetaMask first, wallet connect usually is more complicated to make it work.

Thanks
With your help I am making some progress.
I have removed all the code for walletconnect and Moralis.Web3API.token.getTokenPrice(options) is now working on all my devices.

However if I try to connect to Metamask from the Metamask browser using:-
async function login() {
try {
let user = Moralis.User.current();
if (!user) {
user = await Moralis.Web3.authenticate();
const Web3 = await Moralis.enableWeb3();
}
console.log(“logged in user:”, user);
let lblOutput = document.getElementById(‘lbl-Output’);
lblOutput.innerText = “Connected to Metamask”;
} catch (error) {
console.log(‘Transaction failed’, error);
let lbl = document.getElementById(‘lbl-Output’);
lbl.innerText = error.message;
}
}

It just throws up the same old error message Non…

Have I something wrong in this part of the code to connect with metamask?

try to use Moralis.authenticate

what version of Moralis SDK are you using?

Tried Moralis.authenticate() instead but there is still no attempt to connect with metamask.

It should be the latest version I only downloaded it a week ago.
Is there somewhere it tells you?

you can find out the version if you run this: Moralis.CoreManager.get("VERSION")

If this helps, it says version is:- js1.3.5

that means that you are using latest version

Darn it. Still no joy at all connecting to MetaMask from my dApp on my iPhone.

Do you have any other ideas I could try?

if you use an older version for Moralis SDK, like 0.0.180, then it works?