Is there an easy way to make the original floatbox window close after using the print function ? The new "print" window closes fine but I'd like to be able to close the original window too.
If anyone can help please make it simple.... I'm only a novice with JavaScript .
Thanks.
How can I Print then automatically close window ?
Page: 1
Author | Post |
---|---|
tobtob
|
#1 Thu Mar 05, 2009 1:48 pm
|
Guest | |
#2 Fri Mar 06, 2009 1:22 am
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
This is pretty easy to do, but you have to modify the floatbox.js code.
In the standard v3.24 floatbox.js file, at line 2384 (close to the bottom), find: setTimeout(function() { win && win.print(); win && win.close(); }, 200); return true; Between those two lines, insert the following line: this.end(); |
tobtob
|
#3 Wed Apr 15, 2009 1:15 pm
|
Guest |
I'd like to use the newest version 3.5.0 . I don't see anything like the "patch" you provided above. Can you describe a way to do this in the newest version ?
Thanks. |
#4 Wed Apr 15, 2009 10:12 pm
|
|
Administrator
Registered: Aug 2008
Posts: 3382
|
In the new version you can do this:
Near the bottom of modules/printContents.js, find the line: pdoc.write('<!DOCTYPE html><html><head>' + styles + '</head><body>' + html + and add an unload function like this: pdoc.write('<!DOCTYPE html><html><head>' + styles + '</head><body onunload="window.opener.fb.end();">' + html + In the next release I'll have an afterPrint callback function available which will do this much more cleanly (i.e., not by editing the code). |
tobtob
|
#5 Thu Apr 16, 2009 7:11 pm
|
Guest |
Thanks, that worked perfectly. I like the idea of having a " afterPrint callback function " that can be set. Other than editing the code. Good job !
|
Page: 1