判断当前地址是http还是https

var ishttps = 'https:' == document.location.protocol ? true: false;
if(ishttps){
alert('https');
}else{
alert('http');
}

你可能感兴趣的:(http,https,网络协议)