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

  2. dm

    rf Guest

    Can't be done.

    Cheers
    Richard.
     
    rf, Feb 12, 2004
    #2
    1. Advertisements

  3. dm

    Steve Pugh Guest

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

    Steve
     
    Steve Pugh, Feb 12, 2004
    #3
  4. dm

    Sid Ismail 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.


    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

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

    dm Guest

    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

    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

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

    Steve Pugh Guest

    Yup. Horrible isn't it?
    Yup. Horrible isn't it?
    Yup. Horrible isn't it?
    Yup. Much nicer.

    Steve
     
    Steve Pugh, Feb 13, 2004
    #10
  11. dm

    Eric Bohlman Guest

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.