1// $Id: browser.js 34765 2021-12-06 10:41:54Z dmf $ 2// Determine a bunch of info related to the user's browser capabilities in order to help us tailor their user exeperience to their device. 3 4(function() { 5 function cc(str) { 6 var input = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 7 var output = 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'; 8 return str.split('').map(function(x){ return input.indexOf(x) > -1 ? output[input.indexOf(x)] : x }).join(''); 9 } 10 // Build our query string... 11 var fields = '?ua=' + encodeURIComponent(navigator.userAgent); 12 var qp = document.currentScript.src.indexOf("?"); 13 var ms = ( qp > 0 ? document.currentScript.src.substring(qp + 1) : ""); 14 if (ms) { fields += ms; } else 15 if (typeof uasGIFsuffix != 'undefined' && uasGIFsuffix != '') { fields += uasGIFsuffix; } 16 if (typeof window.screen.width != 'undefined') { fields += '&sr=' + encodeURIComponent(window.screen.width + 'x' + window.screen.height); } 17 if (typeof window.screen.availWidth != 'undefined') { fields += '&ar=' + encodeURIComponent(window.screen.availWidth + 'x' + window.screen.availHeight); } 18 if (typeof window.devicePixelRatio != 'undefined') { fields += '&pr=' + encodeURIComponent(window.devicePixelRatio || 0); } 19 if (typeof window.screen.colorDepth != 'undefined') { fields += '&cd=' + encodeURIComponent(window.screen.colorDepth || 0); } 20 if (typeof navigator.language != 'undefined') { fields += '&nl=' + encodeURIComponent(navigator.language); } 21 if (typeof navigator.languages != 'undefined') { fields += '&fl=' + encodeURIComponent(navigator.languages[0]); } 22 if (typeof navigator.platform != 'undefined') { fields += '&pl=' + encodeURIComponent(navigator.platform); } 23 if (typeof navigator.oscpu != 'undefined') { fields += '&os=' + encodeURIComponent(navigator.oscpu); } 24 if (typeof navigator.productSub != 'undefined') { fields += '&ps=' + encodeURIComponent(navigator.productSub); } 25 if (typeof navigator.webdriver != 'undefined') { fields += '&wd=' + encodeURIComponent(navigator.webdriver); } 26 if (typeof navigator.cookieEnabled != 'undefined') { fields += '&ce=' + encodeURIComponent(navigator.cookieEnabled); } 27 if (typeof navigator.deviceMemory != 'undefined') { fields += '&dm=' + encodeURIComponent(navigator.deviceMemory); } 28 if (typeof navigator.maxTouchPoints != 'undefined') { fields += '&mt=' + encodeURIComponent(navigator.maxTouchPoints); } 29 if (typeof navigator.onLine != 'undefined') { fields += '&ol=' + encodeURIComponent(navigator.onLine); } 30 // Character Set 31 if (typeof document.characterSet != 'undefined') { fields += '&cs=' + encodeURIComponent(document.characterSet); } 32 else if (typeof document.charset != 'undefined') { fields += '&cs=' + encodeURIComponent(document.charset); } 33 else if (typeof document.inputEncoding != 'undefined') { fields += '&cs=' + encodeURIComponent(document.inputEncoding); } 34 if (typeof document.defaultCharset != 'undefined') { fields += '&dc=' + encodeURIComponent(document.defaultCharset); } 35 // Timezone info 36 var d = new Date(); 37 if (typeof d.getTime === 'function') { fields += '&tzt=' + encodeURIComponent(d.getTime()); } 38 if (typeof d.toString === 'function') { fields += '&tzd=' + encodeURIComponent(d.toString()); } 39 if (typeof d.getTimezoneOffset === 'function') { fields += '&tzo=' + encodeURIComponent(d.getTimezoneOffset()); } 40 if (typeof Intl === 'object' && typeof Intl.DateTimeFormat === 'function' && typeof Intl.DateTimeFormat().resolvedOptions === 'function') { 41 if (typeof Intl.DateTimeFormat().resolvedOptions().timeZone != 'undefined') { 42 fields += '&tzr=' + encodeURIComponent(Intl.DateTimeFormat().resolvedOptions().timeZone); 43 } 44 if (typeof Intl.DateTimeFormat().resolvedOptions().locale != 'undefined') { 45 fields += '&tzl=' + encodeURIComponent(Intl.DateTimeFormat().resolvedOptions().locale); 46 } 47 } 48 // Where are we and how'd we get here 49 if (typeof document.referrer != 'undefined') { fields += '&rf=' + encodeURIComponent(cc(document.referrer)); } 50 if (typeof location.href != 'undefined') { fields += '&lh=' + encodeURIComponent(cc(location.href)); } 51 // Detailed WebGL info 52 if (typeof document.createElement === 'function') { 53 var canvas = document.createElement('canvas'); 54 if (typeof canvas === 'object' && typeof canvas.getContext === 'function') { 55 try { 56 var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); 57 if (typeof gl === 'object' && typeof gl.getExtension === 'function' && typeof gl.getParameter === 'function') { 58 var debugInfo = gl.getExtension('WEBGL_debug_renderer_info'); 59 fields += '&gv=' + encodeURIComponent(gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL)); 60 fields += '&gr=' + encodeURIComponent(gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL)); 61 } 62 } catch (e) { /* squelch */ } 63 } 64 } 65 if (typeof fvt != 'undefined' && fvt != '') { fields += '&fvt=' + fvt; } 66 //alert(fields); 67 (new Image).src = '/s/uas.gif' + fields; 68})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.