Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Printing IFrame is printing whole window contents

Thread Tools

Printing IFrame is printing whole window contents

Posts: n/a
Here is the problem, guyz

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

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

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

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


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing all contents of Iframe lebohang Software 1 01-25-2011 04:56 AM
window.print() not printing whole page prabhjot singh Javascript 8 10-22-2009 01:50 PM
how to use an iframe as a link (make the whole iframe clickable) mi HTML 4 05-21-2008 10:13 PM
*WITHOUT* using: ValidateRequest="False" for the whole page (or my whole site).... \A_Michigan_User\ ASP .Net 2 08-21-2006 02:13 PM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM