Results 1 to 4 of 4

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

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

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

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

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •