Tycho_Brahe
10-13-2008, 04:13 PM
This question is conceptual to some degree and has to do with how browsers send and receive data from the web server. Specifically, when the browser asks for one page I get back two ( one internal to the browser and one external page to be opened in adobe reader ). Please correct anything you see wrong and set me straight. I just want to learn how this works.
Here's what happened:
1. I have an aspx page that presents to the user a UI with some drop-down boxes and a button which says "Print...".
2. User clicks the Print button, the server does some calculations then using a third party PDF writer class it draws on a 'canvas' then writes that canvas into the Response.
3. The user's browser receives the response and displays a PDF in the browser.
4. User has to hit the back button to get back to the UI page ( step 1 )
So, we noticed that there was a Boolean parameter for the method in the PDF class called IsInline which if we changed it to false altered the behavior. Now the steps changed to:
1. I have an aspx page that presents to the user a UI with some drop-down boxes and a button which says "Print...".
2. User clicks the Print button, the server does some calculations then using a third party PDF writer class it draws on a 'canvas' then writes that canvas into the Response (?).
3. The user's browser blinks and displays the UI ( see step 1 ) in the original window, fixing the back button problem.
4. Simultaneous to step 3, the browser displays a dialog that says "Do you want to open or save this file ?" with OPEN, SAVE and CANCEL buttons. Note: While the dialog is present, the animated IE or firefox gif spins as if the page isn't finished loading even though the UI page looks to be completely drawn.
5. If the user clicks OPEN, the PDF is opened external to the browser ( in the stand-alone Adobe Reader ).
My question:
What information is sent back to the browser to tell it that in addition to the UI page, there is also a PDF page that needs to be opened ? I've looked in the browser's View Source for the served source code and can't find anything relating to the PDF file and I couldn't find anything relating to any type of javascript that might be doing a window.open to open the PDF. The page type when it comes back still seems to be text/html. I'm assuming for the PDF file the page type would be application/pdf ?
So, the browser has asked ( or posted and expects ) for one page back from the server and we get back the original UI page and are prompted to open the PDF ( externally ). As far as the browser is concerned, where is the request ? In other words, where can I see it ? Is it in the header that comes with each page response ? If so, I'd like to know what tool I can use to view this response. If not, can anyone explain how this works ?
Let me know if this doesn't make sense and I'll try to explain it better.
Thanks !
Eric Gooden
Here's what happened:
1. I have an aspx page that presents to the user a UI with some drop-down boxes and a button which says "Print...".
2. User clicks the Print button, the server does some calculations then using a third party PDF writer class it draws on a 'canvas' then writes that canvas into the Response.
3. The user's browser receives the response and displays a PDF in the browser.
4. User has to hit the back button to get back to the UI page ( step 1 )
So, we noticed that there was a Boolean parameter for the method in the PDF class called IsInline which if we changed it to false altered the behavior. Now the steps changed to:
1. I have an aspx page that presents to the user a UI with some drop-down boxes and a button which says "Print...".
2. User clicks the Print button, the server does some calculations then using a third party PDF writer class it draws on a 'canvas' then writes that canvas into the Response (?).
3. The user's browser blinks and displays the UI ( see step 1 ) in the original window, fixing the back button problem.
4. Simultaneous to step 3, the browser displays a dialog that says "Do you want to open or save this file ?" with OPEN, SAVE and CANCEL buttons. Note: While the dialog is present, the animated IE or firefox gif spins as if the page isn't finished loading even though the UI page looks to be completely drawn.
5. If the user clicks OPEN, the PDF is opened external to the browser ( in the stand-alone Adobe Reader ).
My question:
What information is sent back to the browser to tell it that in addition to the UI page, there is also a PDF page that needs to be opened ? I've looked in the browser's View Source for the served source code and can't find anything relating to the PDF file and I couldn't find anything relating to any type of javascript that might be doing a window.open to open the PDF. The page type when it comes back still seems to be text/html. I'm assuming for the PDF file the page type would be application/pdf ?
So, the browser has asked ( or posted and expects ) for one page back from the server and we get back the original UI page and are prompted to open the PDF ( externally ). As far as the browser is concerned, where is the request ? In other words, where can I see it ? Is it in the header that comes with each page response ? If so, I'd like to know what tool I can use to view this response. If not, can anyone explain how this works ?
Let me know if this doesn't make sense and I'll try to explain it better.
Thanks !
Eric Gooden