473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Printing Iframe content

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 '05 #1
2 12465

Right, the crossdomains issue, there's no access, lest print() method, to
other than local/caller domain due to security, if you can do away with the
frames altogether, do so and instead use Divs and have the server language
instead, fetch the data from the other domain and paste it in the page for
the client, so all fall within the same domain and the access is granted
for js. Can't use XMLHttpRequest either, it can only make requests to the
same server, so, the solution is to remove the crossdomain objects in
frames and have the server language instead, fetch them and then serve
them.
Danny
Oct 21 '05 #2
ni*******@gmail.com 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
Oct 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Catherine Lynn Smith | last post by:
I want to know the recommended way to handle scripting of/with containers such as an iframe. I have a page with border-navigation bars on the top/bottom/left/right and I want to use an iframe to...
4
by: Marina Ferguson | last post by:
Hi, I have a document with an iframe. The main doc has a "Print" button. The idea is that when the user clicks it, the contents of the iframe is printed. For some reason instead of the iframe...
0
by: Vince | last post by:
I have a generic page that I use for printing content, and it contains an iframe into which I put the url for the page to be printed. I dynamically size the iframe so that it correctly displays...
3
by: PCgeek | last post by:
sorry moved this over to javascript forum, didn't mean to post 2x! Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page...
2
by: lisha | last post by:
I have code which generates html table on the fly and fills it up with data. i have to add a print button so that i am able to print the output in html table to the printer. Also, is it possible to...
1
meenakshia
by: meenakshia | last post by:
hi forum i m facing a problem regarding printing withing the frames page i have a main frame page. which has on the left the menu html page loaded and on the right the target content page. when i...
3
meenakshia
by: meenakshia | last post by:
hi forum i m facing a problem regarding printing withing the frames page i have a main frame page. which has on the left the menu html page loaded and on the right the target content page. when i...
8
by: jay123 | last post by:
hello, i really need help from you experts. my problem is i have one page abc.aspx, and then their is other page called def.aspx(which is printable version), which gives some information used...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.