printing external html

Discussion in 'HTML' started by dm, Feb 12, 2004.

  1. dm

    dm Guest

    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
    dm, Feb 12, 2004
    #1
    1. Advertising

  2. dm

    rf Guest

    "dm" <> wrote in message
    news:c0f11f$kco$...
    > 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.
    rf, Feb 12, 2004
    #2
    1. Advertising

  3. dm

    Steve Pugh Guest

    "rf" <> wrote:
    >"dm" <> wrote in message
    >news:c0f11f$kco$...
    >>
    >> 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.


    Well it can... but only by using frames and JavaScript.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Feb 12, 2004
    #3
  4. dm

    Sid Ismail Guest

    On Wed, 11 Feb 2004 22:56:10 -0600, dm <> wrote:

    : 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
    Sid Ismail, Feb 12, 2004
    #4
  5. dm

    Steve Pugh Guest

    Steve Pugh <> wrote:

    >"rf" <> wrote:
    >>"dm" <> wrote in message
    >>news:c0f11f$kco$...
    >>>
    >>> 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.

    >
    >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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Feb 12, 2004
    #5
  6. dm

    dm Guest

    Steve Pugh wrote:
    > Steve Pugh <> wrote:
    >
    >
    >>"rf" <> wrote:
    >>
    >>>"dm" <> wrote in message
    >>>news:c0f11f$kco$...
    >>>
    >>>>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.

    >>
    >>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
    >


    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
    dm, Feb 12, 2004
    #6
  7. dm

    dm Guest

    Sid Ismail wrote:
    > On Wed, 11 Feb 2004 22:56:10 -0600, dm <> wrote:
    >
    > : 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
    dm, Feb 12, 2004
    #7
  8. dm

    rf Guest

    "Steve Pugh" <> wrote in message
    news:...
    > "rf" <> wrote:
    > >"dm" <> wrote in message
    > >news:c0f11f$kco$...
    > >>
    > >> 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.

    >
    > 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.
    rf, Feb 12, 2004
    #8
  9. dm <> wrote:
    > 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.
    --
    Michael Wilcox
    mjwilco at yahoo dot com
    Essential Tools for the Web Developer - http://mikewilcox.t35.com
    Michael Wilcox, Feb 12, 2004
    #9
  10. dm

    Steve Pugh Guest

    "rf" <> wrote:
    >"Steve Pugh" <> wrote:
    >>
    >> 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".


    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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Feb 13, 2004
    #10
  11. dm

    Eric Bohlman Guest

    Steve Pugh <> wrote in
    news::

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

    >
    > 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.
    Eric Bohlman, Feb 14, 2004
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon B
    Replies:
    7
    Views:
    7,495
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  2. Scott Allen
    Replies:
    8
    Views:
    10,927
    Scott Allen
    May 2, 2004
  3. dm

    printing external html page

    dm, Feb 12, 2004, in forum: Javascript
    Replies:
    2
    Views:
    114
  4. Mellow Crow
    Replies:
    6
    Views:
    416
    Richard Cornford
    Nov 4, 2005
  5. John
    Replies:
    1
    Views:
    120
    shimmyshack
    Mar 31, 2007
Loading...

Share This Page