更新时间:2023-12-03 10:12:40
使用 window.location.protocol
检查是否 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:';
}