Bing New Redirect

Redirect if element not found on Bing search or chat pages

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==
// @license MIT
// @name         Bing New Redirect 
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Redirect if element not found on Bing search or chat pages
// @author       SOPL
// @match        https://www.bing.com/search?*
// @match        https://www.bing.com/chat?*
// @grant        none
// ==/UserScript==

// 
(function() {
    'use strict';

    // Function to check for the element and redirect if not found
    function checkAndRedirect() {
        if (!document.getElementById('b-scopeListItem-conv')) {
            // First redirect
            window.location.href = "https://www.bing.com/account/action?scope=web&cc=au";

            // Set a timeout for 3 seconds and then redirect to the second URL
            setTimeout(function() {
                window.location.href = "https://www.bing.com/account/general?id=region_section#region-section";
            }, 3000);
        }
    }

    // Execute the function
    checkAndRedirect();
})();