1. #1
    Sencha User 2b3pro's Avatar
    Join Date
    Jan 2011
    Location
    Tokyo
    Posts
    21
    Answers
    3
    Vote Rating
    0
    2b3pro is on a distinguished road

      0  

    Default Answered: Opening a new window/url using window.open after Ext.Msg.Prompt

    Answered: Opening a new window/url using window.open after Ext.Msg.Prompt


    Code:
    Ext.Msg.prompt('Access Code', 'Enter Access Code:', function(buttonId, value) {
        if (value != record.raw.passcode && value != "thePassCode") {
             Ext.Msg.alert('Wrong Code', 'This code is invalid. Try again.', Ext.emptyFn);
        } else {
                 window.open(redirect_url, "_blank");
                 //document.location.href=redirect_url;   // this works, but in the same window
        }
    }, null, false, null, { placeHolder: 'XXXXX' });
    The above code is found for an itemtap function that fires when an item on a list is clicked.

    When there is no prompt, using window.open works when the list item is clicked upon.

    When I add the access code prompt, the window.open ceases to work.

    Why, and/or how do I get around this? fix this?

    Thank you!

  2. Thank you, Mitchell. It works. The problem was that MobileSafari and Desktop Safari were both set to "Block Pop-Ups".

    Will this happen when the webapp is saved as an "app"? In other words, once deployed, will the general settings of the browsers affect how the app handles javascript window.open in the device or will it be sandboxed with its own preferences? Ultimately, I want the web app to open a window in the browser.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is this on a device? I tried this in Chrome and Safari and it works:

    Code:
    Ext.Msg.prompt('Access Code', 'Enter Access Code:', function(buttonId, value) {
        if (value) {
            window.open('http://www.sencha.com', '_blank');
        }
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User 2b3pro's Avatar
    Join Date
    Jan 2011
    Location
    Tokyo
    Posts
    21
    Answers
    3
    Vote Rating
    0
    2b3pro is on a distinguished road

      0  

    Default It works.

    It works.


    Thank you, Mitchell. It works. The problem was that MobileSafari and Desktop Safari were both set to "Block Pop-Ups".

    Will this happen when the webapp is saved as an "app"? In other words, once deployed, will the general settings of the browsers affect how the app handles javascript window.open in the device or will it be sandboxed with its own preferences? Ultimately, I want the web app to open a window in the browser.

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If you save a web app to the homescreen it won't be launched in safari, it's just a webview so the preferences for safari *shouldn't* affect it. If you are packaged then it's up to the packager if it supports window.open (hint, not gonna have much success AFAIK).
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread