Use window.location.protocol
to check if it is https:
function isSecure()
{
return window.location.protocol == 'https:';
}
Alternatively you can omit specifying "window" if you don't have a locally scoped location.
function isSecure()
{
return location.protocol == 'https:';
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…