Modify Accept-Language Header

Force Accept-Language header to include en-US and zh-CN

23.09.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Modify Accept-Language Header
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Force Accept-Language header to include en-US and zh-CN
// @author       You
// @match        *://*/*
// @grant        none
// @license      MIT 
// ==/UserScript==

(function() {
    'use strict';

    // Intercept and modify XMLHttpRequest to change headers
    var open = XMLHttpRequest.prototype.open;
    XMLHttpRequest.prototype.open = function() {
        this.addEventListener('readystatechange', function() {
            if (this.readyState === 4) {
                // Set both en-US and zh-CN in the Accept-Language header
                this.setRequestHeader('Accept-Language', 'en-US,en;q=0.9,zh-CN,zh;q=0.8');
            }
        });
        open.apply(this, arguments);
    };

    // Intercept fetch to modify headers
    var originalFetch = window.fetch;
    window.fetch = function() {
        arguments[1] = arguments[1] || {};
        arguments[1].headers = arguments[1].headers || {};
        // Set both en-US and zh-CN in the Accept-Language header
        arguments[1].headers['Accept-Language'] = 'en-US,en;q=0.9,zh-CN,zh;q=0.8';
        return originalFetch.apply(this, arguments);
    };
})();