SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2000
    Location
    Montreal, Canada
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello
    I have found a JavaScript that I would like to use but while it works in netscape, it doesn't work in MSExplorer. Can you tell me how to get it working in both browsers?

    This is the script:

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function printPage() {
    if (window.print) {
    agree = confirm('This page contains sensitive information that \nwe recommend you print a copy of at this time. \n\nOK to print now?');
    if (agree) window.print();
    }
    }
    // End -->
    </script>
    Thanks for any help

  2. #2
    Grumpy Mole Man Skunk's Avatar
    Join Date
    Jan 2001
    Location
    Lawrence, Kansas
    Posts
    2,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd be very surprised if Netscape supports any form of printing from a javascript call - still, you never know...

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2000
    Location
    Montreal, Canada
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This script opens the print confirmation window in Netscape. The user then clicks OK to actually print the document.

    I just cannot find the command to open the print confirmation window in Explorer.

    I am using it on pages that are print friendly (don't contain the banners, navigation, etc... just text) just trying to save ink for visitors to the site and thought I would add a little extra user friendliness to it.

    Scarlet

  4. #4
    Non-Member spdrcr's Avatar
    Join Date
    Sep 2000
    Location
    Oklahoma City, OK
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wouldnt it just be easier to skip a script, and just have them CTRL P or somethin. If you are havin that much trouble with cross browser compat then I would say until you find an easier way to do it...you might just do that for now...

    SR

  5. #5
    Irritability Defined
    Join Date
    Jul 2000
    Location
    80,000 feet below the surface
    Posts
    1,442
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Scarlet, which version of IE are you using (and which platform - Mac or PC)? I've seen window.print work in IE4, but on my IE5.5 it fails.

    The only other thing I can think of is that the 'alert' is interrupting the script, and causing IE to fail to recognise the script.

    Otherwise.... Check this script and see if you can adapt the code *shudders*
    My 2 Cents (or is that 2.2 Cents including GST?)


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
  •