WebAPI/Navigator.hasFeature: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 48: Line 48:
* api.window.Navigator.mozMobileConnections
* api.window.Navigator.mozMobileConnections
* api.window.XMLHttpRequest.mozSystem
* api.window.XMLHttpRequest.mozSystem
== Examples ==
The first example checks to see if we're running on the low-memory Tarako device:
  navigator.getFeature("hardware.memory").then(function(mem) {
    if (mem <= 128) {
      alert("We are in a memory constrained world!");
    }
  });
The second example checks to see if the privileged FM Radio API is available.
  navigator.hasFeature("api.window.Navigator.mozFMRadio").then(enabled) {
    if (enabled) {
      alert("FM Radio support detected, my privileged app will work!");
    }
  });
Confirmed users
657

edits

Navigation menu