Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

WifiManager.associate()

This API is available on Firefox OS for internal applications only.

Summary

The associate method is used to associate (and connect) a device with a given WiFi network.

Syntax

var request = navigator.mozWifiManager.associate(network);

Parameters

network
A network object as the ones provided by the getNetworks or getKnownNetworks methods.

Associating a secured network with the device requires setting some extra properties on the network object passed to the method:

  • For network with WEP encryption method:
    • wep: This property must be set with the proper password to access the network.
  • For network with WPA-PSK encryption method:
    • psk: This property must be set with the proper password to access the network.
  • For network with WPA-EAP encryption method:
    • eap: A string representing the EAP method to use.
    • password: A string representing the password to access the network.
    • identity: A string representing the identity to access the network.
    • pin: A string representing the pin code required to access the network.

Returns

It returns a DOMRequest to handle the success or error of the operation. A successful operation means than the device enters the connection workflow to the provided network. The success or failure of the connection itself can be tracked through the statuschange event by attaching an event handler to WifiManager.onstatuschange.

Specification

Not part of any specification.

See also

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, teoli, kscarfone, Jeremie
 Last updated by: chrisdavidmills,