Printing IFrame is printing whole window contents

Discussion in 'Javascript' started by Amit, Sep 8, 2006.

  1. Amit

    Amit Guest

    Here is the problem, guyz

    In the chat transcripts section you can print chat transcript from two
    ways.

    1) ChatTranscript.aspx (All the chat topics are there you
    can click on print button and you can print specific topic)

    2) DisplayChatTranscript.aspx (After clicking on the chat
    topic it opens up the chat and you can click print button and print
    that chat)



    They both have an IFrame which opens up PrintChatTranscript.aspx and
    This file prints itself by using "window.print" on "body onload" event.



    Now the problem is when we print through ChatTranscript.aspx it prints
    its own screenshot instead of printing Contents in the IFrame which is
    PrintChatTranscript

    But the DisplayChatTranscript.aspx works fine and prints the Contents
    from IFrame which is PrintChatTranscript.aspx


    I did some research and what i came up with is.

    When we print from ChatTranscript.aspx file. It sets IFrame location to
    PrintChatTranscript.aspx which prints itself.

    Now in PrintChatTranscript.aspx when i did the research i came to know
    that PrintChatTranscript is not able to access IFrame object. when i
    tried accessing it through

    top.window.IFramename.focus( );

    It gives me error "Jscript Runtime Error Permission Denied"

    Another file has the same code and its able to print the IFrame
    contents. All 3 files are in the same folder so there is not security
    issue.

    Moreover when it says Iframe.location="PrintChatTranscript.aspx" it
    loads the contents into it.

    But when PrintChatTranscript.aspx says "window.print" it prints the
    whole window because its not able to access the IFrame object. Its not
    existing in the Object Hierarchy.

    Can Anybody Help ?? will really Appreciate that. i am stucked on this
    issue.

    Thanks
    Amit
    Amit, Sep 8, 2006
    #1
    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. \A_Michigan_User\
    Replies:
    2
    Views:
    867
    \A_Michigan_User\
    Aug 21, 2006
  2. mi
    Replies:
    4
    Views:
    13,344
    dorayme
    May 21, 2008
  3. Roger Pack
    Replies:
    3
    Views:
    86
    Caleb Clausen
    Dec 2, 2009
  4. Daedalous
    Replies:
    3
    Views:
    651
    Daedalous
    Jan 16, 2004
  5. prabhjot singh

    window.print() not printing whole page

    prabhjot singh, Oct 21, 2009, in forum: Javascript
    Replies:
    8
    Views:
    523
Loading...

Share This Page