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!

2 Answers 2

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.

1
  • if using vscode, using 'express host current workspace' will do the job
    – Roberto C.
    Nov 13, 2018 at 0:33
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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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