display pdf in new window

Discussion in 'Javascript' started by timothy ma and constance lee, Sep 4, 2004.

  1. Sirs

    I got the problem how to display a generated pdf file into a new windows in
    xml using javascript: window.open

    My program is in this way:

    <form= abc action=1.servlet>
    </form>

    onclick="javascript:document.abc.submit"

    But it opens a pdf file in the same window so my original one is overriden
     
    timothy ma and constance lee, Sep 4, 2004
    #1
    1. Advertising

  2. timothy ma and constance lee

    DU Guest

    timothy ma and constance lee wrote:
    > Sirs
    >
    > I got the problem how to display a generated pdf file into a new windows in
    > xml using javascript: window.open
    >
    > My program is in this way:
    >
    > <form= abc action=1.servlet>
    > </form>
    >
    > onclick="javascript:document.abc.submit"
    >


    comp.lang.javascript FAQ
    Referencing Forms and Form Controls.
    The Most Common Mistake
    http://www.jibbering.com/faq/faq_notes/form_access.html#faComMis

    > But it opens a pdf file in the same window so my original one is overriden
    >
    >


    <script type="text/javascript">
    var WindowObjectReference = null;
    function OpenRequestedPDFFile()
    {
    if(WindowObjectReference == null || WindowObjectReference.closed)
    {
    WindowObjectReference = window.open("path/filename.pdf",
    "PDFWindowName", "location,menubar,resizable,scrollbars,status");
    }
    else
    {
    WindowObjectReference.focus();
    };
    }
    </script>
    </head>
    <body>
    ....
    <form name="FormName" action="1.servlet" onsubmit="OpenRequestedPDFFile();">
    [...]

    <p><input type="submit" value="Submit the form">Note that the submission
    of the form will open a new window loading a <img src="PDFIconLogo.gif"
    width="..." height="..." alt="PDF" title="PDF" style="cursor:
    customizedPDF.cur, auto;"> file and starting Adobe Acrobat Reader in
    that new window. [...file size...]KB</p>
    </form>

    Not tested.

    DU
    --
    The site said to use Internet Explorer 5 or better... so I switched to
    Netscape 7.2 :)
     
    DU, Sep 4, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y2hhem1hbmlhbg==?=

    Display PDF (or other file) in new browser window

    =?Utf-8?B?Y2hhem1hbmlhbg==?=, Jun 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    12,802
    Raterus
    Jun 4, 2004
  2. Norman Yuan
    Replies:
    0
    Views:
    585
    Norman Yuan
    Jun 3, 2008
  3. Moe Sisko
    Replies:
    0
    Views:
    994
    Moe Sisko
    Jun 4, 2008
  4. Ricardo Pog
    Replies:
    1
    Views:
    488
    Austin Ziegler
    Mar 26, 2008
  5. Sean Nakasone
    Replies:
    1
    Views:
    428
    Farrel Lifson
    Apr 14, 2008
Loading...

Share This Page