Printing Iframe content

Discussion in 'Javascript' started by nightstar@gmail.com, Oct 21, 2005.

  1. Guest

    I am creating a web page that will contain multiple Iframes. One of
    the Iframes will contain a bill of sale that is generated by a script
    on x.mydomain.com/somefile.php?someparameters. One of the Iframes will
    contain a PDF of a multiple page scanned document (this iframe can be
    printed via the acrobat reader print button). The other iframes will
    contain a jpeg of a scanned document which comes from
    y.mydomain.com/somelocation/file.jpg.

    The first iframe containing the bill of sale and each iframe containing
    a jpeg could need to be printed. I will need to add a button on the
    parent page (not within the iframe) to the bill of sale and each jpeg
    iframe there after. This way the user can choose which documents to
    print.

    I have a function on the order of:

    function (framename)
    {
    framename.focus();
    framename.print();
    }

    then i make a button for each iframe, each iframe has a different name.

    On my local development client I can get the bill of sale to print
    (which is on the same x.domain.com as this multiple iframe script is
    on) When I goto print the jpegs (on y.mydomain.com) I get an access
    denied.


    Is there an easy way of doing this. Any help appreciated.
     
    , Oct 21, 2005
    #1
    1. Advertising

  2. RobG Guest

    wrote:
    > I am creating a web page that will contain multiple Iframes. One of
    > the Iframes will contain a bill of sale that is generated by a script
    > on x.mydomain.com/somefile.php?someparameters. One of the Iframes will
    > contain a PDF of a multiple page scanned document (this iframe can be
    > printed via the acrobat reader print button). The other iframes will
    > contain a jpeg of a scanned document which comes from
    > y.mydomain.com/somelocation/file.jpg.
    >
    > The first iframe containing the bill of sale and each iframe containing
    > a jpeg could need to be printed. I will need to add a button on the
    > parent page (not within the iframe) to the bill of sale and each jpeg
    > iframe there after. This way the user can choose which documents to
    > print.
    >
    > I have a function on the order of:
    >
    > function (framename)
    > {
    > framename.focus();
    > framename.print();
    > }
    >
    > then i make a button for each iframe, each iframe has a different name.
    >
    > On my local development client I can get the bill of sale to print
    > (which is on the same x.domain.com as this multiple iframe script is
    > on) When I goto print the jpegs (on y.mydomain.com) I get an access
    > denied.
    >
    >
    > Is there an easy way of doing this. Any help appreciated.
    >


    The advice provided by FAQ #19 seems appropriate. Browser security
    stops you from accessing anything in a window from another domain, not
    even the src attribute of the iframe that it's displayed in.

    Best to collate the pages on your server and serve them from there.

    You could put an object in your page that has frameName:url pairs so you
    can get the URL from there then open a new window loaded with the 'other
    domain' URL. But you can't remotely print it[1], the user would have to
    print it (say press ctrl+p) for the same cross-domain reason noted above.

    From the FAQ:

    <URL:http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp>


    [1] Calling window.print() on a child window with a page loaded from
    another domain seems problematic in the browsers I tested - it works
    sometimes on some browsers but not most of the time for others. Its
    unreliability makes it unsuitable for a corporate Intranet or general
    web environment.



    --
    Rob
     
    RobG, Oct 21, 2005
    #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. Yann Laviolette

    Printing content of IFRAME

    Yann Laviolette, Jan 14, 2004, in forum: HTML
    Replies:
    3
    Views:
    8,928
    Yann Laviolette
    Jan 14, 2004
  2. hazz
    Replies:
    6
    Views:
    49,773
    SkyUCHC
    Jun 9, 2010
  3. Daedalous
    Replies:
    3
    Views:
    753
    Daedalous
    Jan 16, 2004
  4. nc
    Replies:
    0
    Views:
    162
  5. Amit
    Replies:
    0
    Views:
    206
Loading...

Share This Page