Bing New Redirect

Redirect if element not found on Bing search or chat pages

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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();
})();