在Ext.Msg.confirm之后在另一个窗口中打开URL

时间:2012-04-26 14:57:45

标签: extjs confirmation

        floTrackBtn: {
            tap:            
            function() {
                window.open('http://www.flotrack.org/'); //WORKS
                Ext.Msg.confirm("", "Are you sure you want to navigate to Flotrack?", 
                    function(answer){
                        if (answer == 'yes'){
                            window.open('http://www.flotrack.org/'); //DOES NOT WORK
                        }                           
                    });
            }
        }   

第一个window.open有效,但在确认消息框内,它没有。任何帮助都会很棒。谢谢!

1 个答案:

答案 0 :(得分:0)

我尝试在Chrome中运行您的代码。代码绝对正确,它工作正常。

首次运行此代码时,Chrome浏览器会阻止弹出窗口,因此您需要选择“Always allow pop-up from this page”。

当您选择该选项时,您将获得o / p。

 ...
 ...
 {
    xtype:'button',
    text:'CLick me',
    centered:true,
    listeners : {
         tap: function() {
            window.open('http://www.flotrack.org/'); //WORKS
            Ext.Msg.confirm("", "Are you sure you want to navigate to Flotrack?", 
                               function(answer){
                                     if (answer == 'yes'){
                                        window.open('http://www.flotrack.org/'); // THIS ALSO WORKS FINE !!
                                     }                           
                            });
                        }
                    }
                }
 ...
 ...

样本o / p: -

enter image description here

当我选择yes选项时,它会打开一个带有给定URL的弹出窗口。

enter image description here