WebAPI/WebNFC: Difference between revisions

Line 244: Line 244:
   
   
  Sample example to demonstrate the construction of an url as an NDEF Message:
  Sample example to demonstrate the construction of an url as an NDEF Message:
var tnf    = NDEF.TNF_WELL_KNOWN;
  ''var tnf    = NDEF.TNF_WELL_KNOWN;
var type    = NDEF.RTD_URI;
  var type    = NDEF.RTD_URI;
var id      = new Uint8Array();
  var id      = new Uint8Array();
// Short Record, 0x3 or "http://"
  // Short Record, 0x3 or "http://"
var payload = new Uint8Array(NfcUtils.fromUTF8(
  var payload = new Uint8Array(NfcUtils.fromUTF8(
                             '\u0003mozilla.org'));
                             '\u0003mozilla.org'));
var  urlNDEF = new MozNDEFRecord(tnf, type, id, payload);
  var  urlNDEF = new MozNDEFRecord(tnf, type, id, payload);
   
   
// Call writeNdef() API with urlNDEF
  // Call writeNdef() API with urlNDEF''


== NDEF Connect Example ==
== NDEF Connect Example ==
Confirmed users
118

edits