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:
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";