Commit 6fabeb2a authored by Michael Schloh von Bennewitz's avatar Michael Schloh von Bennewitz 💻

Correct algorithm to determine browser and WebNFC optional configuration.

parent 3e74106e
......@@ -240,7 +240,7 @@
<div class="input-group-prepend">
<button type="button" class="btn btn-success" id="read-probut" title="Read Data" data-toggle="modal" data-target="#statread">Read Data</button>
</div>
<button type="button" class="form-control" data-toggle="collapse" data-target="#cardcoll-ndef" role="button" placeholder="Display NDEF data" aria-label="Display NDEF data">Toggle NDEF Data</button>
<button type="button" class="form-control" data-toggle="collapse" data-target="#cardcoll-ndef" role="button" placeholder="Display NDEF data" aria-label="Display NDEF data">Toggle Window</button>
</div>
<!--<small class="form-text text-muted" id="form-name" for="validatname">Read values from a (pressed) EPROM</small>-->
......@@ -1017,13 +1017,34 @@ $(".custom-switch :checkbox").on("click dblclick", function(evt) {
// Selectively display lack of WebNFC (should test features or version)
//if (!('nfc' in navigator)) { // Test for NFC support
if (!("NDEFReader" in window)) { // Test for NFC support
var isChromium = window.chrome;
var winNav = window.navigator;
var vendorName = winNav.vendor;
var isOpera = typeof window.opr !== "undefined";
var isIEedge = winNav.userAgent.indexOf("Edge") > -1;
var isIOSChrome = winNav.userAgent.match("CriOS");
if (isIOSChrome) {
// is Google Chrome on IOS
} else if(
isChromium !== null &&
typeof isChromium !== "undefined" &&
vendorName === "Google Inc." &&
isOpera === false &&
isIEedge === false
) {
$("#nav-explat").removeClass('d-none').addClass('d-flex');
} else {
$("#nav-brwnfc").removeClass('d-none').addClass('d-flex');
}
// The following block does not correctly determine WebNFC options
//if (!/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())) {
if (!!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime)) {
$("#nav-explat").removeClass('d-none').addClass('d-flex');
}
else {
$("#nav-brwnfc").removeClass('d-none').addClass('d-flex');
}
//if (!!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime)) {
// $("#nav-explat").removeClass('d-none').addClass('d-flex');
//}
//else {
// $("#nav-brwnfc").removeClass('d-none').addClass('d-flex');
//}
} // Test for hardware circuit when reading and writing to radio
// Initialise to use popover tips
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment