+
80
-

js如何判断页面是否是https?

js如何判断页面是否是https?

网友回复

+
0
-
var ishttps = 'https:' == document.location.protocol ? true: false;

if(ishttps){
 alert("这是一个https请求");

}else{
 alert(“这是一个http请求”);

}

我知道答案,我要回答