SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict TegSkywalker's Avatar
    Join Date
    Nov 2001
    Location
    USA
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs down How do i print a page in IE5 for Mac? window.print() doesn't work

    Hey all. I am currently putting together a test page of mine where a popup window comes up showing a coupon that I will have a link enabling them to print it simply and easily.

    For my current code I have a simple <a href="javascript:window.print()"> that works great on both Internet Explorer 5 and Netscape 4/6 on the PC but for some reason, Internet Explorer 5 for Macintosh doesn't do a thing.

    Is there an alternate code I have to use for Macintosh IE5 or do I have to tweak what I currently have. Suggestions are good.

  2. #2
    SitePoint Member
    Join Date
    Dec 2001
    Location
    UK
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I honestly don't think there is anything you can do. It seems to me it's a browser bug, you could try:

    <script language="Javascript">
    <!--

    function printpage() {
    window.print();
    }

    //-->
    </script>

    And then in your body tag:

    <body onload="printpage()"

    Which would automatically bring up a "print this page" dialogue box. However, this is pretty annoying, and the user will not know where it's coming from, if it's a pop window also. Again, there's no guarantees this will work, as it failed on this JavaScript before - perhaps MAC IE is behind with JavaScript updates.

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I do not have a Mac, but...

    Try the following:

    <SCRIPT>
    <!--
    function printit(){
    if (window.print) {
    window.print() ;
    } else if (document.all) {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 6); //Use a 1 vs. a 6 for a prompting dialog box
    WebBrowser1.outerHTML = "";
    }
    }
    //-->
    </script>
    Be sure the OBJECT tag all goes on one single line. Then call it with a button or link:
    <INPUT TYPE="button" onClick="printit()" value="Print Page">

    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •