iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
一些JQUERY插件源码里都看了这一句,不知道是做什么用的
有一段注释:
// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
1、正则判断当前 url 是否以 https 开头
1、1 利用短路防止 test 的参数为 undefined 或 null,即当 window.location.href 为 undefined 或者 null 时,test 可获得 || 后的 '' 作为参数
2、三元运算(boolean ? reg1 : reg2),当前 url 以 https 开头则 iframeSrc 值为 'javascript:false',否则为 'about:blank'