If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.

Browser-Check

From BoxMatrix


BoxMatrix >> Webinterface >> Browser-Check @ BoxMatrix   -   IRC-Chat   -   Translate: de es fr it nl pl
News Selectors Models Accessories Components Environment Config Commands System Webif Software Develop Lexicon Community Project Media

UI-Structure UI-Modules HTML-Files XML-Files Lua-Scripts Javascript Browser SSI-Files SSI-Directives HTML-Text Event-Text Help-Pages CSS-Files Graphics Research

Info
Starting with firmware / labor 6.35 AVM introduced a Browser-Check to verify the JavaScript capabilities of your browser. This check is implemented in browser.js and if it fails you get redirected to sorry.html or sorry.lua, and you will not be able to access the Webinterface until you upgraded your browser (or use a workaround). browser.js checks for a bunch of JavaScript objects and methods (functions of objects) which are required to run the Webinterface properly. Which methods are tested and which are used differs across firmware versions. This section shows what is tested and wich parts of the Webinterface depend on each tested method.

Browser-Check[edit]

Daily updated index of all browser checks found scanning Firmware-Probes . Last update: 2024-10-15 08:36 GMT.
The label (brchk) in the Method column shows there are other objects in this wiki using this name.
The Mod column shows the amount of models using the respective JavaScript method. Click the column header to sort by this number.
The Usage and Firmware columns show which files use the respective JavaScript method and in which firmwares.
As you can see most methods were used long before they were part of a Browser-Check.

Online-Check[edit]

Here you can test which of the above methods your current browser supports:

Workarounds[edit]

browser.js is included by content.lua, login.lua and surf.lua. It is accessible at https://fritz.box/js/browser.js.
To defeat the Browser-Check you can create a custom filter for this URL in your favourite adblocker.

Starting with firmware 6.36 you can defeat the Browser-Check by calling https://fritz.box/?nbc=1. (nbc = no browser check)
This will set the gNbc variable (global no browser check, see below) from box.get.nbc in index.lua and no further checks occur for this session.
Alternatively index.lua also supports the POST method to set the gNbc variable from box.post.nbc.

A third method replacing a possibly missing window.Promise.prototype.finally() method with a greasemonkey userscript containing a polyfill is explained here.
Using polyfills for missing methods would be a way better approach for FRITZ!OS than browser.js and sorry.lua. :)

Checker-Versions[edit]

So far there are 5 different versions of the checker browser.js. These scripts are cited here for research purposes and were formatted for readability. They are all (C) AVM GmbH:

Firmware 6.35[edit]

The initial version (201 bytes) only checks for window.Blob() and redirects to sorry.html on failure:

var ok=true
try {
    var blob=new window.Blob(['<a></a>'], { type : 'text/html' });
    ok=("object"===typeof blob);
} catch(err) {
    ok = false;
}
if (!ok) {
    window.location.href="sorry.html"
}

Firmware 6.36[edit]

The second version (257 bytes) could be defeated, also checks for window.requestAnimationFrame() and redirects to sorry.lua on failure:

var ok=true
try {
    if (!gNbc) {
        var blob=new window.Blob(['<a></a>'], { type : 'text/html' });
        ok=("object"===typeof blob);
        ok=ok && window.requestAnimationFrame;
    }
} catch(err) {
    ok=false;
}
if (!ok) {
    window.location.href="sorry.lua";
}

Firmware 7.19[edit]

The third version (410 bytes) adds checks for window.Proxy(), array.forEach() and window.Promise():

var ok=true, gNbc;
try {
    if (!gNbc) { 
        ok=ok && window.Proxy && (typeof(new window.Proxy({},function(){}))==="object");
        ["1"].forEach(function(){});
        ok=ok && window.Promise && (typeof(new window.Promise(function(){}))==="object");
        ok=ok && window.Blob && (typeof(new window.Blob(["<a></a>"],{type:"text/html"}))==="object");
        ok=ok && window.requestAnimationFrame && true;
    }
} catch(err) {
    ok=false;
}
if (!ok) {
    window.location.href="sorry.lua";
}

Firmware 7.24[edit]

The fourth version (459 bytes) also checks for window.Promise.resolve() and window.Promise.prototype.finally():

var ok=true, gNbc;
try {
    if (!gNbc) {
        ok=ok && window.Proxy && typeof new window.Proxy({},function(){})==="object";
        ["1"].forEach(function(){});
        ok=ok && window.Promise && typeof new window.Promise(function(){})==="object";
        ok=ok && window.Blob && typeof new window.Blob(["<a></a>"],{type:"text/html"})==="object";
        ok=ok && window.requestAnimationFrame && true;
        ok=ok && window.Promise.resolve(true).finally(function(){});
    }
} catch(err) {
    ok=false;
}
if (!ok) {
    window.location.href="sorry.lua";
}

Firmware 7.39[edit]

The fifth version (519 bytes) also checks for window.BigInt().

 var ok=true; var nbc=gNbc||false;
 try {
     if (!nbc) {
         ok=ok && window.Proxy && typeof new window.Proxy({},function(){})==="object";
         ["1"].forEach(function(){})
         ok=ok && window.Promise && typeof new window.Promise(function(){})==="object";
         ok=ok && window.Blob && typeof new window.Blob(["<a></a>"],{type:"text/html"})==="object";
         ok=ok && window.requestAnimationFrame && true;
         ok=ok && window.Promise.resolve(true).finally(function(){});
         ok=ok && (typeof window.BigInt("1")==="bigint");
    }
} catch(err) {
    ok=false;
}
if (!ok) {
    window.location.href="sorry.lua";
}

Discussion[edit]

  • There's an IPPF-Thread about the 7.24 browser check (german language, english welcome)

Fact-Box