怎样判断当前窗口是否处在加密环境

即: https:// 为加密环境, http:// 为非加密环境. 

需要使用window.isSecureContext; 如果是https, 则返回true, 反之返回false;

window.isSecureContext; // true
原文地址:https://www.cnblogs.com/aisowe/p/11703164.html