javascriptbrowserwifi

How to connect to Wi-Fi in a browser


I have been searching for an answer on how to connect to a WiFi hotspot using Javascript in browser.

Context: I'm building a page that show WiFi information such as SSID and Password after scanning a QRCode, and the page shows which Network you're going to connect to before actually connecting for security

I have found this : php-wifi, which seems to be what I want in PHP, but nothing for Wifi interface in Browser Javascript, I've search "wifi" in npmjs but no success.

I'd like it to work on all devices, if possible

Thanks for your help


Solution

  • It would be impossible to scan network on browser due to restricted access by design, but you could do it on Node.JS with this package: https://www.npmjs.com/package/node-wifi.

    For browser, only limited network information could be retrieved, check this document: https://wicg.github.io/netinfo/