HTTP重定向至HTTPS

自动将HTTP重定向为HTTPS,提升安全性和性能。

目前为 2024-05-20 提交的版本。查看 最新版本

// ==UserScript==
// @name         HTTP重定向至HTTPS
// @name:en      HTTPS Follow Redirect
// @name:zh-CN   HTTP重定向至HTTPS
// @name:zh-TW   HTTP重定向至HTTPS
// @namespace    https://t.me/T8rAP
// @version      0.1
// @description  自动将HTTP重定向为HTTPS,提升安全性和性能。
// @description:en Automatically redirects HTTP to HTTPS, enhancing security and performance.
// @description:zh-CN 自动将HTTP重定向为HTTPS,提升安全性和性能。
// @description:zh-TW 自動將HTTP重定向為HTTPS,提升安全性和性能。
// @author       DreamProStudio
// @match        http://*/*
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';
    // 检查当前协议是否为HTTP
    if (window.location.protocol === 'http:') {
        // 获取当前URL并将协议部分替换为HTTPS
        var httpsURL = 'https:' + window.location.href.substring(5);
        // 使用replace方法进行重定向,不会在浏览历史中留下记录
        window.location.replace(httpsURL);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址