Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1086 Problems when printing

You are here: irt.org | FAQ | JavaScript | Bugs | Q1086 [ previous next ]

Symptom: Trying to print a page that
1. writes content based on a prompt and a cookie writes the wrong data or
2. trying to print a frame that has a framing script gives a frame was empty error

Affects: Netscape Communicator 4 4.06+

Reason: Netscape re-renders the page before printing - a cookie using a domain, will get a different cookie back because Netscape emulates a user. It also executes any scripts found on the page...

Workaround: The following works:

NowPrinting = false;
if (document.layers && self.innerWidth==0 && self.innerHeight==0) NowPrinting=true; // Hack for printing
// Now we can use it to test before executing scripts like this:
if (!NowPrinting && top.location.href.indexOf("frameset.html") == -1)
  top.location.href = "frameset.html?frame1.html";

©2018 Martin Webb