I am building a very simple dapp. At first I want to initiate web3 on the webpage and then enable it so that I can access web3.eth.getAccounts().

MetaMask, and Opera Mobile both have a window.ethereum.enable() function which will prompt the user to allow the webpage to access the wallet. Once they do that, I can call web3.eth.getAccounts, like this: