Bing New Redirect

Redirect if element not found on Bing search or chat pages

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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();
})();