Files
AlwaysHTTPS/app/scripts.babel/contentscript.js
2016-06-02 18:07:13 +08:00

21 lines
344 B
JavaScript

'use strict';
(function(){
function redirectToHttps() {
window.location.href = window.location.href.replace(/^http:/, 'https:')
}
function checkHttps() {
if (location.protocol !== 'http:') {
return
}
if (/^[0-9\.]+$/.test(location.host)) {
return
}
redirectToHttps()
}
checkHttps()
})()