This is an archived page. It's not actively maintained.


The sendFile() method of the MozNFCPeer interface sends a file — over a non-NFC data channel — to another device.

Note: sendFile() currently uses Bluetooth for data transport.


var req = nfcPeer.sendFile(flieblob);


var nfcdom = window.navigator.mozNfc;
nfcdom.onpeerready = function(event) {
  var nfcPeer = nfcdom.getNFCPeer(event.detail);
  var blob = ... // construct a 'blob' that is of type 'file'.
  // This 'blob' will be passed onto / handover to Bluetooth interface for the actual file transfer. (Wifi handover is not yet supported)
  var req = nfcPeer.sendFile(blob);
  req.onsuccess = function(e) {
    console.log("Successfully sent file");
  req.onerror = function(e) {
    console.log("Send file failed!");


The Blob file reference to be transferred.


A DOMRequest object.


Error("Unable to create NFCPeer object, Reason:  Bad SessionToken")


The NFC implementation in Gecko follows the NFC Forum specifications.

Browser compatibility

Supported in Firefox OS 2.0 for certified-apps.
Available in privileged apps as of Firefox OS 2.2.

See also