gcc vpn防掉线

每隔一分钟访问一次指定的URL

// ==UserScript==
// @name         gcc vpn防掉线
// @namespace    http://tampermonkey.net/
// @version      0.3
// @description  每隔一分钟访问一次指定的URL
// @author       LinXingJun
// @include      *://*.vpn.gcc.edu.cn:*/*
// @include      *://vpn.gcc.edu.cn/*
// @grant        GM_xmlhttpRequest
// @connect      *
// @license MIT
// ==/UserScript==
function gethtml(){
    console.log("开始请求:".concat(Date.now()));
 GM_xmlhttpRequest({
            method: "GET",
            url: "http://cnki-net-s.vpn.gcc.edu.cn:8118/?loadTime=".concat(Date.now()),
            headers: {
                "Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
            },
            onload: function(response){
                console.log("请求成功:".concat(Date.now()));
            },
            onerror: function(response){
                console.log("请求失败:".concat(Date.now()));
                console.log(response);
            }
        })
}
(function() {
    gethtml();
    // 定义每60秒(60000毫秒)执行一次函数
    setInterval(gethtml, 60000); // 60000ms = 1分钟
})();