Chrome Permissions

Skip to first unread message

Kira Corbin

Feb 27, 2020, 12:28:17 AM2/27/20
to Native-Client-Discuss

I'm want to create a pop-up message to the user to allow permissions for NFC reader to be read from a webpage.

I have Javascript code written and linked to the html, but no pop-up is activated. 

I'm not getting the pop up to fire, I want to get it working on all browsers and smart phones.

These are my console log errors.
Uncaught ReferenceError: NDEFReader is not defined at permissions.js:73
permissions.js:17 Uncaught (in promise) TypeError: Failed to execute 'query' on 'Permissions': GenericSensorExtraClasses flag is not enabled.
    at checkPermission (permissions.js:17)
    at permissions.js:36
/client/client.ed17b3c8.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
permissions.js:45 [Deprecation] getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See for more details.
requestGeolocation @ permissions.js:45

Here is my code:
// make permissions request work
// state of permissions: granted, denied, prompt

// Status of a permission
if ('permissions' in navigator) {
    var logTarget = document.getElementById('logTarget');

    function handleChange(permissionNamenewState) {
        var timeBadge = new Date().toTimeString().split(' ')[0];
        var newStateInfo = document.createElement('p');
        newStateInfo.innerHTML = '' + timeBadge + ' State of ' + permissionName + ' permission status changed to ' + newState + '.';

    function checkPermission(permissionNamedescriptor) {
        try {
            navigator.permissions.query(Object.assign({ name: permissionName }, descriptor))
                .then(function (permission) {
                    document.getElementById(permissionName + '-status').innerHTML = permission.state;
                    permission.addEventListener('change'function (e) {
                        document.getElementById(permissionName + '-status').innerHTML = permission.state;
        } catch (e) {

    checkPermission('push', { userVisibleOnly: true });
    checkPermission('midi', { sysex: true });

    var noop = function () { };
    navigator.getUserMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);

    function requestGeolocation() {

    function requestNotifications() {

    function requestPush() {
            .then(function (serviceWorkerRegistration) {

    function requestMidi() {
        navigator.requestMIDIAccess({ sysex: true });

    function requestCamera() {
        navigator.getUserMedia({ video: true }, noopnoop)

    function requestMicrophone() {
        navigator.getUserMedia({ audio: true }, noopnoop)

// API glimpse
const reader = new NDEFReader()
// Creates an object used for NDEF readings.
//   Returns a Promise resolved if starting NFC scan was successful.
// An event fired when a new reading is available.
// An event fired when an error happened during reading.
const writer = new NDEFWriter()
// Creates an object used for NDEF writings.
//   Returns a Promise resolved if writing the message(String, ArrayBuffer or NDEF record) with options was successful.

Derek Schuff

Feb 27, 2020, 11:13:47 AM2/27/20
Hi Kira,
This mailing list is for discussion of Native Client specifically, so this post about general JS and permissions is off-topic (and you aren't really reaching the right set of experts in any case). Offhand I don't know of any other mailing lists that are meant for webNFC, but there is the W3C community group ( and of course the obvious.

You received this message because you are subscribed to the Google Groups "Native-Client-Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages