Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Printing Iframe content

Reply
Thread Tools

Printing Iframe content

 
 
nightstar@gmail.com
Guest
Posts: n/a
 
      10-21-2005
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.

 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      10-21-2005
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

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
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
Printing IFrame is printing whole window contents Amit Javascript 0 09-08-2006 02:19 AM
How To pop content into bottom IFrame from top IFrame nc Javascript 0 08-10-2004 01:19 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
Printing content of IFRAME Yann Laviolette HTML 3 01-14-2004 10:39 PM



Advertisments