5

I'm building a DAPP it works fine when I host it from a server, but when the HTML file is local MetaMask gives this error:

MetaMask does not allow file:// protocol, use http(s)://

Any ideas what that means or if theres a way to get it to work? Thanks!

user714171
  • 641
  • 5
  • 13

2 Answers2

3

It's a browser security related thing, more can be found here.

The main excerpt:

Http(s) - Web Server Required

Due to browser security restrictions, we can't communicate with dapps running on file://. Please use a local server for development.

You have to start a local web server and access your HTML file from it.

Tudor Constantin
  • 2,625
  • 1
  • 9
  • 15
0

You need to open your file into a local webserver. I am using lighttpd as light weight webserver that recognize Metamask.

1.Go to http://lighttpd.dtech.hu/

2.Download LightTPD-1.4.35-1-IPv6-Win32-SSL.zip (or 64)

3.Extract it to local folder, i.e. C:\LightTPD

4.Run LightTPD.exe

5.Put your Dapp into C:\lighttpd\htdocs

6.Open http://localhost/ (and your Dapp web3 file)

Extrange planet
  • 685
  • 5
  • 11