Page 1 of 4 123 ... LastLast
Results 1 to 10 of 36

Thread: Open a new browser window

  1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    57
    Vote Rating
    0
      0  

    Question Open a new browser window

    Hello all,

    in ExtJS an ajax request is calling a php script to create a PDF document.
    That's working fine and without problems. I got the PDF after it and my ajax "success" handler is running ...

    ... but how can i automatically open that PDF file in that ajax handler ?

    window.open(..) > No, it's opening a new ExtJS window, not a new browser window.

    Some ideas ?

    Snoop

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,891
    Vote Rating
    89
      0  

    Default

    You will have to use an iframe as the body of the Ext.Window with the src set to the URL which produces the PDF.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Uh

    Isn't there a simple function to open a new browser window with an URL ?

    Something simple like:
    browser.open("http://...")

    I have to open sometimes a new browser window. Working with iframes within the body will produce a lot of work.

    Snoopy

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,190
    Vote Rating
    1000
      0  
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Thanks for your answer, evant.

    Maybe (or better surely) i'm standing on the line - completly.

    I know the javascript window.open() function - but how can i execute this call within my ajax handler ?

    Snoopy

  6. #6
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,190
    Vote Rating
    1000
      0  

    Default

    Put it in there as code, same as you would with anything else. I don't really understand why you're confused, perhaps some code would help.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Part of the code (my ajax request):

    Code:
    Ext.Ajax.request({
      url: 'run.php?format=pdf',
      success: function(result,request) { 
        var jsonData = Ext.util.JSON.decode(result.responseText);
        window.open("test.php?id=123");
      },
      failure: function(result,request) { 
        var jsonData = Ext.util.JSON.decode(result.responseText);
        Ext.Msg.alert('Error', jsonData.feedback.reason); 
      }
    });

  8. #8
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,190
    Vote Rating
    1000
      0  

    Default

    Yep, that's how you should do it. So where's the problem?
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  9. #9
    Sencha User
    Join Date
    Jun 2009
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Nothing happens
    No new window or new tab - nothing.

    I'm using Firefox.
    There is no popup blocker or something like that installed or active. No tools, nothing.
    So i'm not understanding, why this is not working. I'm trying it now for > 4 hours.

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,891
    Vote Rating
    89
      -1  

    Default

    Simple?

    What's complex about

    Code:
    new Ext.Window({
        title: 'My PDF',
        height: 400,
        width: 600,
        bodyCfg: {
            tag: 'iframe',
            src: 'test.php?id=123',
            style: 'border: 0 none'
        }
    }).show();

Page 1 of 4 123 ... LastLast

Posting Permissions

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