Open Acrobat Reader with javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael

    Open Acrobat Reader with javascript

    A webpage has the following js:
    function openPDF(PDFdoc)

    {

    // Open a blank window and target PDFdoc into it.

    // PDFdoc = web address (URL) of the PDF document to present in a pop-up
    window


    var new_window = window.open("", "pdf",parameter s);

    new_window.docu ment.location = PDFdoc;

    }

    The issue is it works OK on Win2kSP4 IE 6.0.2800.1106 Acrobar Reader 6.0.0,
    but on Win XP SP1 IE 6.0.2800.1106 Acrobat Reader 6.0.2 it pops up the
    window without starting AR. Security settings are the same on both IE.



    Please help.

    Thank you all.


  • Vincent van Beveren

    #2
    Re: Open Acrobat Reader with javascript

    Did you try new_window.loca tion.href = PDFDoc?

    Michael wrote:
    [color=blue]
    > A webpage has the following js:
    > function openPDF(PDFdoc)
    >
    > {
    >
    > // Open a blank window and target PDFdoc into it.
    >
    > // PDFdoc = web address (URL) of the PDF document to present in a pop-up
    > window
    >
    >
    > var new_window = window.open("", "pdf",parameter s);
    >
    > new_window.docu ment.location = PDFdoc;
    >
    > }
    >
    > The issue is it works OK on Win2kSP4 IE 6.0.2800.1106 Acrobar Reader 6.0.0,
    > but on Win XP SP1 IE 6.0.2800.1106 Acrobat Reader 6.0.2 it pops up the
    > window without starting AR. Security settings are the same on both IE.
    >
    >
    >
    > Please help.
    >
    > Thank you all.
    >
    >[/color]

    Comment

    • Richard Cornford

      #3
      Re: Open Acrobat Reader with javascript

      Michael wrote:[color=blue]
      > A webpage has the following js:
      > function openPDF(PDFdoc)[/color]
      <snip>[color=blue]
      > var new_window = window.open("", "pdf",parameter s);
      >
      > new_window.docu ment.location = PDFdoc;[/color]

      It is bizarre to be doing that (assigning to a location object) as:-

      var new_window = window.open(PDF doc, "pdf", parameters);

      - should do much the same without the potential timing issues that
      follow from the fact that window opening is asynchronous (so the -
      document - could not necessarily be expected to exist mere milliseconds
      after the - window.open - call).

      Also, - document.locati on - is usually a reference to the - location -
      object on the window's global object, and it is generally considered
      preferable to be using that global - location - object directly:-

      new_window.loca tion = PDFdoc;

      - but not when the URL is used as the first argument to the -
      window.open - call.

      Richard.


      Comment

      Working...