[thelist] Print in IE

Mark Howells mark at mountain.ch
Tue Feb 19 04:19:01 CST 2002


>>> there is.  you're going to kick yourself too -- it's
>>> so simple.  it's the print() method.  tada!  it's
>>> available as of ie5+.
>>
>> .... except for Mac. This is a royal pain in the bum if
>> you want to add a "print me" button to a popped-up
>> window with no toolbar, [...]
>
> the solution i provided *does* work.  it calls the print()
> method if the user agent supports it, otherwise it pops an alert() dialog
> with instructions for the user.

Yes, this works fine on all platforms I checked during my tests last year.

> the alternative would be to use document.write() to only write out the html
> with the onclick event handler that calls the print() method if the user
> agent supports the print() method to begin with.  that would mean no button
> for non-js users

... who won't have a popup window anyway. They would have a new window with
all of the normal browser chrome as I would have built the page using
alternative functionality for users with no Javascript.

<a href="myFrame.html" target="_blank" onclick="pop('myFrame.html');return
false">View data sheet</a>

> that still brings us back to the issue of opening a new window containing a
> document you expect them to be able to print but without the necessary
> toolbar or menubar

Which is one of the reasons that I chose not to implement it -- as I said
earlier, there's no way of achieving this functionality cross-browser and
cross-platform without using the standard browser toolbar for some users.

Regards
Mark Howells
<http://www.mark.ac/evl>




More information about the thelist mailing list