在Ext.Ajax.request()中调用时extjs 4.0不一致的window.open()行为 [英] extjs 4.0 inconsistent window.open() behavior when called within Ext.Ajax.request()

查看:91
本文介绍了在Ext.Ajax.request()中调用时extjs 4.0不一致的window.open()行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
window.open(url)不同的行为-相同的代码,不同的时间

Possible Duplicate:
window.open(url) different behavior - same code, different timing

我将让我的代码段解释我所遇到的问题.

I'll let my code snippet explain the issue I'm seeing.

function myFunction() {
    window.open('http://www.yahoo.com');  // --> this opens a new tab on my browser
    Ext.Ajax.request({
        url: 'PHP function call',
        success: function(response) {
            window.open('http://www.yahoo.com');  // --> this opens a new window, not tab
        }
    });
}

这很奇怪.通过研究此问题,我了解到目前没有方法可以强制打开浏览器选项卡而不是浏览器窗口.话虽如此,我仍然想知道是否有任何解决方法.我的应用程序设计方式是,每次我调用window.open()时,都会打开一个选项卡,但这种情况除外,因此我的客户感到很烦.任何见识将不胜感激.

This is very strange. From researching this issue, I understand there currently exists no way to force a browser tab to open instead of a browser window. That being said, I'm still wondering if there's any workaround. The way my app is designed, every time I call window.open() a tab is opened except for this one case and therefore my clients find it very annoying. Any insight would be greatly appreciated.

除了下面贾斯汀的建议外,我还尝试了以下方法:

In addition to Justin's suggestion below I also tried the following:

function myFunction() {
    var myWin = window;
    myWin.open('http://www.yahoo.com');  // --> this opens a new tab on my browser
    Ext.Ajax.request({
        url: 'PHP function call',
        success: function(response) {
            myWin.open('http://www.yahoo.com');  // --> this opens a new window, not tab
        }
    });
}

推荐答案

这是时间.如果您的请求花费了更多时间,那么3秒钟左右的浏览器就会认为它是弹出窗口.几周前看一下我的问题: window.open(url)不同的行为-相同的代码,不同的时间

This is timing. If your request takes more then ~3s browser will think it's popup window. Take a look on my question couple weeks ago: window.open(url) different behavior - same code, different timing

这篇关于在Ext.Ajax.request()中调用时extjs 4.0不一致的window.open()行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆