• Skip to main content
  • Select language
  • Skip to search
mozilla
Mozilla Developer Network
  • Sign in
    • Persona
    • GitHub
  • Web Platform
    Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • APIs / DOM
    • Apps
    • MathML
    References & Guides
    • Learn the Web
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • ...more docs
  • Mozilla Docs
    • Add-ons
    • Firefox
    • Firefox Marketplace
    • Firefox OS
    • Persona
  • Developer Tools
  • Feedback
    • Get Firefox help
    • Get web development help
    • Join the MDN community
    • Report a content problem
    • Report a bug
  •  
B2G OS
    • No translations exist for this article.
    • Add a translation
  • Edit
  • Advanced
    • History
    • Print this article
  1. MDN
  2. Mozilla
  3. B2G OS
  4. Firefox OS APIs
  5. MozNFCPeer
Your Search Results

    MozNFCPeer

    In This Article
    1. Methods
    2. Example
    3. Specifications
    4. Browser compatibility
    5. See also

    This API is available on Firefox OS for privileged or certified applications only.

    NFCPeer provides a Peer to Peer (P2P) interface to interact with other NFC-enabled devices. It is used to send NDEF messages and transfer files.

    MethodsEdit

    MozNFCPeer.sendFile()
    sendFile() sends files to other NFC-enabled devices. This should be called inside a mozNFC.onpeerfound() event callback.  This method is available in certified apps only.
    MozNFCPeer.sendNDEF()
    sendNDEF() sends NDEF Messages to other NFC-enabled devices. This should be called inside a mozNFC.onpeerfound() event callback.

    ExampleEdit

    navigator.mozNfc.onpeerfound = function (evt) {
      var peer = evt.peer;
      // ndef is an instance of MozNDEFRecord contains the shared data, like URL.
      peer.sendNDEF([ndef]);
    };

    SpecificationsEdit

    The NFC implementation in Gecko follows the NFC Forum specifications.

    Browser compatibilityEdit

    • Desktop
    • Mobile
    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 alsoEdit

    • Using the NFC API
    • Using the NFC emulator
    • Introduction to NFC (fairly long reference doc, featuring general NFC terms, and some Nokia platform specifics.)
    Share:
    • Twitter
    • Facebook
    • Google+

    Document Tags and Contributors

    Tags: 
    • API
    • Firefox OS
    • Interface
    • MozNFCPeer
    • NFC
    • NFCPeer
    • Reference
     Contributors to this page: chrisdavidmills, fscholz, allstars.chh, lgarner
     Last updated by: chrisdavidmills, Feb 11, 2016, 6:12:35 AM
    See also
    1. NFC API
    2. MozNFCPeer
    3. Methods
      1. sendFile()
      2. sendNDEF()
    4. Related pages for NFC API
      1. MozNDEFRecord
      2. MozNFC
      3. MozNFCTag
      4. Navigator.mozNfc

    © 2005-2016 Mozilla Developer Network and individual contributors.

    Content is available under these licenses.

    • About MDN
    • Terms
    • Privacy
    • Cookies
    • Contribute to the code

    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy