By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,812 Members | 1,650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,812 IT Pros & Developers. It's quick & easy.

javascript:print problem

P: n/a
I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a


Marcus Bjorke wrote:
I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.

Well, not every browser implements the window.print method (IE4 doesn't
for instance) so you should check for it. It also helps to focus the
frame you want to print
<a href="#"
onclick="if (window.print) {
var frame = parent.frames.mainFrame;
if (frame) {
frame.focus();
frame.print();
}
}
return false;">print frame</a>
Note I haven't tested whether that improves things with Opera 7
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
DU
Martin Honnen wrote:


Marcus Bjorke wrote:
I use a print link that causes a problem with Opera 7. The link looks
like this <a href="javascript:parent.frames.mainFrame.print()"> Print
this page</a>

I also used
<a href="javascript:print()">Print this page</a>

and it also worked with most browsers. I realize that it only works if
you have Microsoft Windows versions for PC but that is what most of
out customers have anyway. I have also noticed that there is a problem
with certain browswers, for example Explorer 4 version but also with
newer browser like Opera 7.01. I does work perfecly well with
Mozilla-compatible browsers but why not with Opera. With Opera it
first looks as if it would work, but when you choose print from the
Operating system it prints the wrong frame although i specifically try
to call the right frame. Has anyone found a workaroung or sollution to
my problem.


Well, not every browser implements the window.print method (IE4 doesn't
for instance) so you should check for it. It also helps to focus the
frame you want to print
<a href="#"
onclick="if (window.print) {
var frame = parent.frames.mainFrame;
if (frame) {
frame.focus();
frame.print();
}
}
return false;">print frame</a>
Note I haven't tested whether that improves things with Opera 7


I tried a slightly modified code

<p><button type="button" onclick="top.LeftFrameName.focus();
top.LeftFrameName.print();">Print left frame only</button></p>

in a demo frameset+frames document
and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
left frame while Opera 7.21 printed each frames one after the other.
Not too long ago, I asked in opera.general and opera.beta if it was
possible to print an iframe only and it was confirmed it was not
possible. So, I confidently believe that Opera 7.21 can not print an
individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
MSIE 6) can.

DU

Jul 20 '05 #3

P: n/a
>
in a demo frameset+frames document
and Mozilla 1.5 and MSIE 6 SP2 for Windows printed accordingly only the
left frame while Opera 7.21 printed each frames one after the other.
Not too long ago, I asked in opera.general and opera.beta if it was
possible to print an iframe only and it was confirmed it was not
possible. So, I confidently believe that Opera 7.21 can not print an
individual frame (or iframe) when other browsers (Mozilla 1.5, NS 7.1,
MSIE 6) can.

DU

Thanks! Now i know not to bother with Opera anymore. Seems strange
that the problem has been known so long but there is no sollution.

/marcus
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.