Desktop Mode & Disable DPI Detection

Forces the browser to use desktop mode and prevents sites from determining the browser DPI

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Desktop Mode & Disable DPI Detection
// @namespace    http://dmxdpi.41
// @version      1.0
// @description  Forces the browser to use desktop mode and prevents sites from determining the browser DPI
// @author       FortyOne
// @license MIT
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // Set viewport meta tag to ensure desktop mode
    var viewport = document.createElement('meta');
    viewport.setAttribute('name', 'viewport');
    viewport.setAttribute('content', 'width=1200, user-scalable=yes');
    document.head.appendChild(viewport);

    // Prevent sites from determining browser DPI
    Object.defineProperty(window.screen, 'deviceXDPI', { value: 96, writable: false, configurable: false });
    Object.defineProperty(window.screen, 'logicalXDPI', { value: 96, writable: false, configurable: false });
    Object.defineProperty(window.screen, 'devicePixelRatio', { value: 1, writable: false, configurable: false });
})();