Only some features work in the browser. Notably DHT and relaying does not. See the repository's "Please read this" at https://github.com/ipfs/js-ipfs/#project-status
For a DHT to work, you need to be able to able to connect to be discoverable and be able to connect to multiple peers.
WebRTC unfortunately doesn't allow for this yet.