printing external html


D

dm

hi,
i was wondering if anyone of a way to print an external page. basically,
i have page with a print button. when that button is pushed, i want it
to call up the print dialog to print a different page (not the active
one). any help is appreciated. thanks.

dave
 
Ad

Advertisements

R

rf

dm said:
hi,
i was wondering if anyone of a way to print an external page. basically,
i have page with a print button. when that button is pushed, i want it
to call up the print dialog to print a different page (not the active
one). any help is appreciated. thanks.

Can't be done.

Cheers
Richard.
 
S

Sid Ismail

: hi,
: i was wondering if anyone of a way to print an external page. basically,
: i have page with a print button. when that button is pushed, i want it
: to call up the print dialog to print a different page (not the active
: one). any help is appreciated. thanks.


Here you are: http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

I have successfully used that technique.

Sid
 
S

Steve Pugh

Steve Pugh said:
Well it can... but only by using frames and JavaScript.

Oh, and it depends on whether 'external' means on a different domain
or not. If the page to be printed is from a different domain than the
one with the print button then JavaScript will quite rightly have
security issues.

Steve
 
D

dm

Steve said:
Oh, and it depends on whether 'external' means on a different domain
or not. If the page to be printed is from a different domain than the
one with the print button then JavaScript will quite rightly have
security issues.

Steve

thanks for the reply. i have figured out a way doing just what you
describe (or touched on). i just have a frame that is off the page with
all the content and a print button, which switches focus to that frame
and prints it. seems to work fine. using some code to determine the type
of browser and using respective code for each (ie.
document.nameofframe.focus(); vs.
window.frames['nameofframe'].focus();). seems to work well.

thanks.

dave
 
Ad

Advertisements

D

dm

Sid said:
: hi,
: i was wondering if anyone of a way to print an external page. basically,
: i have page with a print button. when that button is pushed, i want it
: to call up the print dialog to print a different page (not the active
: one). any help is appreciated. thanks.


Here you are: http://www.dynamicdrive.com/dynamicindex9/printstyle.htm

I have successfully used that technique.

Sid

thanks sid,
i did try it that way, but ran into some problems, as it wouldn't print
the alternate document. i believe i tried it in several browsers as
well. i have figured out a way tho (see my other post), which works well
for me.

dave
 
R

rf

Steve Pugh said:
Well it can... but only by using frames and JavaScript.

I assume you mean "not a new page but a page in a hidden frame".

But then I would be downloading two pages every time, just in case I needed
to print the second one.

In any case it won't work if javascript is unavailable and introduces all
the problems frames present.

What is wrong with
<a href="...">Follow this link for a page you can print with your browsers
print button"</a>

Cheers
Richard.
 
M

Michael Wilcox

dm said:
thanks for the reply. i have figured out a way doing just what you
describe (or touched on). i just have a frame that is off the page
with
all the content and a print button, which switches focus to that frame
and prints it. seems to work fine.

That's a horrible abuse of JavaScript and the user's browser. Basically
you've mislead them into thinking that the page that they want printed is
what will be sent to the printer, when in fact they'll be printing something
completely different. Please don't do this to a user.
 
S

Steve Pugh

rf said:
I assume you mean "not a new page but a page in a hidden frame".

Yup. Horrible isn't it?
But then I would be downloading two pages every time, just in case I needed
to print the second one.

Yup. Horrible isn't it?
In any case it won't work if javascript is unavailable and introduces all
the problems frames present.

Yup. Horrible isn't it?
What is wrong with
<a href="...">Follow this link for a page you can print with your browsers
print button"</a>

Yup. Much nicer.

Steve
 
Ad

Advertisements

E

Eric Bohlman

Yup. Much nicer.

But too wordy. <a href="...">Printable version</a> is just fine and is
commonly used. "Follow this link" adds no meaning (what else are you going
to do with a link?); "for a page" doesn't add much meaning, since links go
to pages most of the time and I don't think anyone's expecting the link to
point to downloadable software or loadable music; "with your browser's
print button" is redundant since that's how browser users generally print
stuff in any case.
 
Ad

Advertisements


Top