验证是否登录再js打开新窗口无拦截

来源:互联网 发布:网络女歌手三个字名字 编辑:程序博客网 时间:2024/05/13 12:17
function alertLogin(url) {
        jQuery.ajax({
            cache: false,
            url: '/Customer/IsLogin',
            success: function (msg) {
                if (msg == "false") {
                    $.layer({
                        type: 2,
                        title: false,
                        fix: false,
                        offset: [($(window).height() - 400) / 3 + 'px', '50%'],
                        shade: [0.5, '#AAA', true],
                        area: ['325px', '351px'],
                        iframe: {
                            src: '/' +
                                'Customer/AlertLoginView'
                        }
                    });


                } else {
                    var a = $("<a href="+url+" target='_blank' >test</a>").get(0);
                    var e = document.createEvent('MouseEvents');
                    e.initEvent('click', true, true);
                    a.dispatchEvent(e);
                    //location.href = url;
                    //window.open(url);
                }
            }
        });


    }
0 0
原创粉丝点击