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

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support

No support

No support No support No support No support
Feature Android Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support No support No support 2.0 moz [1] No support No support No support

[1] Available in privileged apps as of Firefox OS 2.2; certified-only before that.

See also


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.