HTTP重定向为HTTPS

自动遵循HTTP重定向(301/302),并请求确认非安全连接

// ==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.5.3
// @description  自动遵循HTTP重定向(301/302),并请求确认非安全连接
// @description:en Automatically follow HTTP redirects (301/302) and ask for confirmation for non-secure connections
// @description:zh-CN 自动遵循HTTP重定向(301/302),并请求确认非安全连接
// @description:zh-TW 自動遵循HTTP重定向(301/302),並請求確認非安全連接
// @author       Cosecant
// @match        http://*/*
// @exclude      *mtw.so*
// @exclude      *.ocoa.cn*
// @exclude      *.news.cn*
// @exclude      *.zwkan.com*
// @exclude      *via-app.cn*
// @exclude      *fc.my71.top*
// @exclude      *.bqgege.com*
// @exclude      *cj.ccxhw.cn*
// @exclude      *www.picdg.co*
// @exclude      *gaopenglaw.com*
// @exclude      *androidxref.com*
// @exclude      *www.ponyemu.com*
// @exclude      *m.xiaoshubao.net*
// @exclude      *game.waimai.zone*
// @exclude      *sn.people.com.cn*
// @exclude      *product.zoioo.com*
// @exclude      *news.china.com.cn*
// @exclude      *www.weather.com.cn*
// @exclude      *olay.mytiantian.top*
// @exclude      *dlc.cnspeedtest.com*
// @exclude      *www.passkeyboard.com*
// @exclude      *gongbao.court.gov.cn*
// @exclude      *luonas.hppro1.hpnu.cn*
// @exclude      *rootesd.liveblog365.com*
// @exclude      *federalgazette.agc.gov.my*
// @license      MIT
// @grant        none
// @run-at       document-start
// ==/UserScript==

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