PageSourceSearch

https://internshala.com/static/js/offerings_device_details.1784865963.js

js internshala.com collected 2026-09-24 08:45:16 UTC 2,762 bytes, 82 lines download raw bytes

1(function () {
2    if (window.__offeringsDeviceDetailsInitialized) {
3        return;
4    }
5    window.__offeringsDeviceDetailsInitialized = true;
6
7    var cachedDeviceDetails = null;
8    var cachedDeviceDetailsJson = null;
9
10    function toStringValue(value) {
11        if (value === null || typeof value === 'undefined') {
12            return '';
13        }
14
15        return String(value);
16    }
17
18    function toNumberValue(value) {
19        return typeof value === 'number' && isFinite(value) ? value : null;
20    }
21
22    function normalizeString(value) {
23        return toStringValue(value).replace(/\s+/g, ' ').trim();
24    }
25
26    function getBackendRecognition() {
27        var browserName = typeof browser_name !== 'undefined' ? normalizeString(browser_name).toLowerCase() : '';
28        var osType = typeof os_type !== 'undefined' ? normalizeString(os_type) : '';
29        var isAndroid = typeof is_android !== 'undefined' ? (is_android ? 1 : 0) : 0;
30        var isMobile = typeof is_mobile !== 'undefined' ? (is_mobile ? 1 : 0) : 0;
31
32        return {
33            os_type: osType || null,
34            browser_name: browserName || null,
35            is_android: isAndroid,
36            is_mobile: isMobile
37        };
38    }
39
40    function getDeviceDetails() {
41        if (cachedDeviceDetails) {
42            return cachedDeviceDetails;
43        }
44
45        var nav = window.navigator || {};
46        cachedDeviceDetails = {
47            viewport: {
48                inner_width: toNumberValue(window.innerWidth),
49                inner_height: toNumberValue(window.innerHeight),
50                outer_width: toNumberValue(window.outerWidth),
51                outer_height: toNumberValue(window.outerHeight),
52                device_pixel_ratio: toNumberValue(window.devicePixelRatio)
53            },
54            navigator: {
55                user_agent: normalizeString(nav.userAgent) || null,
56                vendor: normalizeString(nav.vendor) || null,
57                platform: normalizeString(nav.platform) || null,
58                product: normalizeString(nav.product) || null,
59                app_name: normalizeString(nav.appName) || null,
60                app_version: normalizeString(nav.appVersion) || null,
61                webdriver: nav.webdriver === true
62            },
63            from_backend: getBackendRecognition()
64        };
65
66        return cachedDeviceDetails;
67    }
68
69    window.getDeviceDetails = getDeviceDetails;
70    window.getDeviceDetailsJson = function () {
71        if (cachedDeviceDetailsJson) {
72            return cachedDeviceDetailsJson;
73        }
74
75        try {
76            cachedDeviceDetailsJson = JSON.stringify(getDeviceDetails());
77            return cachedDeviceDetailsJson;
78        } catch (error) {
79            return null;
80        }
81    };
82}());

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.