var matchStr =window.location.href; var reURL = /^(http):\/\//; var isOnLine = (/v.163.com/).test(window.location.href) if(reURL.test(matchStr) && isOnLine){ matchStr = matchStr.replace(reURL, function () { return 'https://' }) window.location.replace(matchStr) } window.loadScript = function (url, callback) { let script = document.createElement('script') script.src = url script.onload = function () { callback && callback() script.parentNode.removeChild(script) } let target = document.getElementsByTagName('script')[0] target.parentNode.insertBefore(script, target) }