-1

I have metamask installed. When I type window.ethereum in the console in a random webpage, I get a Proxy object.

When I type window.ethereum in my locally served webpage on localhost:5000, I get undefined. The page is served using python -m http.server 5000?

How can I get metamask to inject window.ethereum on my local website? When searching for this issue, all solutions suggest running my page with a server, but this is already what I am doing.

0

2 Answers 2

1

This question is repeated.

Run the page with a web server: $ python -m SimpleHTTPServer 8000

check this post: Window.ethereum undefined on tab with local webpage

Hope this works Let me know if you still face the same problem.

2
  • You did not read the question.
    – Gradient
    Commented Jul 20, 2022 at 16:31
  • Don't worry, the moderator who closed the question did not read the question either!
    – Gradient
    Commented Jul 22, 2022 at 7:25
1

I made a mistake in the html file. I wrote <!DOCTYPE> instead of <!DOCTYPE> html>. It seems like window.ethereum is not injected when in Quirks mode.

Not the answer you're looking for? Browse other questions tagged or ask your own question.