Greasy Fork is available in English.

Redirect Script 重定向网页

这个脚本将会监听特定的URL,并在用户访问该URL时将其重定向到一个新的URL。

// ==UserScript==
// @name         Redirect Script 重定向网页
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  这个脚本将会监听特定的URL,并在用户访问该URL时将其重定向到一个新的URL。
// @author       mingfeng
// @match        http://192.168.1.254:8000/portal/local/index.html?weburl=http%3A%2F%2Fwww.msftconnecttest.com%2Fredirect
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // 监听页面加载完成事件
    window.addEventListener('load', function() {
        // 获取当前URL
        var currentURL = window.location.href;

        // 检查当前URL是否匹配目标URL
        if (currentURL.indexOf('http://192.168.1.254:8000/portal/local/index.html?weburl=http%3A%2F%2Fwww.msftconnecttest.com%2Fredirect') !== -1) {
            // 重定向到新的URL
            window.location.href = 'http://192.168.1.254:8000/portal/local/index.html';
        }
    });
})();