iframe页面内点击按钮不跳转问题

1.在iframe中页面不能跳转(案例:登陆超时问题) ,在全局页面中加入如下代码:

      $(document).ready(function(){
    $.ajaxSetup({
        global: false,
        type: "POST",
        complete: function (XMLHttpRequest, textStatus) {
            var data = XMLHttpRequest.responseText;
            if (data == "timeout") {  //这是在服务端拦截器定义的变量
                if( window.top != window.self ){
                    window.top.location = window.location.href;
                }
            }
        }
    });
   
});

    

猜你喜欢

转载自lowser.iteye.com/blog/2280595
今日推荐