- From: Jon Hanna <jon@spin.ie>
- Date: Thu, 22 May 2003 12:01:32 +0100
- To: <w3c-wai-ig@w3.org>
> Can anyone provide links to examples of the accessible use of > window.print () > problems may include, but are not limited to: > Macs, > buttons, > disabling js/nojs/pre js1.2 I'm assuming you are talking just about that actual javascript call, not issues related to printed versions, print stylesheets etc. nor issues with the accessibility of the way the call is triggered. The only problem with the call itself is that it won't work in some cases. In those cases there is no way to make it work; either you can print from javascript or you can't[1], so the only feasible fall-back is to let the user use their browser's normal print command. Hence this script works: if (window.print){ document.write('<p><a href="#" onclick="window.print(); return false;">Print</a></p>'); } We can put that script in somewhere and if the browser is capable of printing then it will write the link into the document. BTW, this has nothing to do with whether it's js1.2 or not, the javascript used here is 1.0 - it's the object model that's the difference. You may want to advise the user when it isn't available. First change the script: if (window.print){ document.write('<p><a href="#" onclick="window.print(); return false;">Print</a></p>'); } else{ document.write('<p>Use your browsers print command to print this page.</p>'): } And you'll also need to use a <noscript/> block: <script type="text/javascript" src="print.js"></script> <noscript> <p>Use your browsers print command to print this page.</p> </noscript> [1] There is a way of making IE4 on Windows print from javascript even though IE4 doesn't have this functionality built-in. It involves using a spl0it that allows you to sneak ActiveX controls into pages even when the security settings shouldn't allow it, as such it's not exactly a recommended way of doing things.
Received on Thursday, 22 May 2003 07:01:59 UTC