window.location.origin 兼容IE

Ie浏览器下,有时候获取到的window.location.origin为undefined,需要兼容

let origin: any;
        if (!window.location.origin) {
          origin = window.location.protocol + '//' + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
        } else {
          origin = window.location.origin;
        }

 

posted @ 2020-03-20 10:49  面包_girl  阅读(1166)  评论(0编辑  收藏  举报
/* 鼠标点击文字特效 */