This problem may be older than IE9; I do not know. Cannot check that for now. Since many patrons have IE9, it would be nice if they could print the contents of the cart on opac. Somehow this does not work now. See discussions like http://stackoverflow.com/questions/2555697/window-print-not-working-in-ie?rq=1 The proposed patch adds some code for IE. Works with setting a small timeout, calling window.print instead of print, and changing location on receiving focus back. Note that this last trick is also browser dependent. I do not favor browser dependent code, but at least we reach the goal of enabling the print function again for IE users..
Created attachment 18464 [details] [review] Bug 10376: Printing cart does not work under IE9 Test plan: 1) Test with Firefox (or any other browser except IE): Add biblio to cart Go to Cart and click Print Does the Cart window come back to its original state after confirm/cancel Print? 2) Test with Internet Explorer (I used IE9; testing another version is fine) Do the same as above. Is behavior now more or less the same?
Created attachment 18723 [details] [review] [SIGNED-OFF] Bug 10376: Printing cart does not work under IE9 Test plan: 1) Test with Firefox (or any other browser except IE): Add biblio to cart Go to Cart and click Print Does the Cart window come back to its original state after confirm/cancel Print? 2) Test with Internet Explorer (I used IE9; testing another version is fine) Do the same as above. Is behavior now more or less the same? Signed-off-by: Marc Veron <veron@veron.ch> 1) Test without patch: IE 10: Does not show print dialog IE 9 (Developer Emulation in IE 10): Does not show print dialog (as expected) FF 21.0 OK Chrome 27.0.1453.110 m: OK 2) Test with patch: IE 10: OK IE 9 (Developer Emulation in IE 10): OK IE 8 (Developer Emulation in IE 10): OK IE 7 (Developer Emulation in IE 10): OK FF 21.0 OK Chrome 27.0.1453.110 m: OK
Marcel, why do you use the obscure IEprint variable? A user will not be able to print twice the basket?
(In reply to comment #2) > Signed-off-by: Marc Veron <veron@veron.ch> Great signoff, Marc, with all these browser versions. Thanks.
(In reply to comment #3) > Marcel, why do you use the obscure IEprint variable? A user will not be able > to print twice the basket? Hi Jonathan, He should normally not be able. But since I am working with a small timeout of 500 ms, I just want to be sure that it does not fire again. Thanks for asking, Marcel
I don't have IE so can't test this
Created attachment 19625 [details] [review] [PASSED QA] Bug 10376: Printing cart does not work under IE9 Test plan: 1) Test with Firefox (or any other browser except IE): Add biblio to cart Go to Cart and click Print Does the Cart window come back to its original state after confirm/cancel Print? 2) Test with Internet Explorer (I used IE9; testing another version is fine) Do the same as above. Is behavior now more or less the same? Signed-off-by: Marc Veron <veron@veron.ch> 1) Test without patch: IE 10: Does not show print dialog IE 9 (Developer Emulation in IE 10): Does not show print dialog (as expected) FF 21.0 OK Chrome 27.0.1453.110 m: OK 2) Test with patch: IE 10: OK IE 9 (Developer Emulation in IE 10): OK IE 8 (Developer Emulation in IE 10): OK IE 7 (Developer Emulation in IE 10): OK FF 21.0 OK Chrome 27.0.1453.110 m: OK Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Trusting Marc here, as I don't have IE available. Regression tests in Firefox and Chromium went well.
Pushed to master. Thanks, Marcel!
This patch has been pushed to 3.12.x, will be in 3.12.7. Thanks Marcel!
Fun fact: Microsoft have changed the navigator.appName property to "Netscape" in IE11, so this latest fix won't work for newer versions of IE. http://msdn.microsoft.com/en-us/library/ie/bg182625(v=vs.85).aspx Conditional comments were also removed in IE 10 which makes "simpler" separation of browser dependent code impossible. http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx -- I've looked at this a million different ways...and there's always a problem. window.onfocus (works great for IE but doesn't work for Chrome or Firefox.) window.setTimeout (this has different syntax in different browsers. While you can get it to work with Chrome + IE or Chrome + FF, you can't seem to get it to work with all 3.) -- I was able to trigger location.href only after the "afterprint" event fired but it didn't make a difference. It still redirected before printing in IE. I tried using this as a guide: http://msdn.microsoft.com/en-us/library/ie/hh273397(v=vs.85).aspx But I can't think of any way to really identify IE as separate from FF or Chrome without more browser detection of some kind. The thing is that "window.onfocus" does work, but you have to remove focus from a FF or Chrome window by switching windows and coming back to it. -- I don't know if there really is a solution to this problem. It probably wouldn't help to open a new window, print, and close, because I think the same thing happens. -- I tried "<body onload="window.print()" onfocus='location.href="/cgi-bin/koha/opac-basket.pl?bib_list=[% bib_list %][% IF ( verbose ) %]&verbose=1[% END %]";'>", which works in IE and Firefox, but not Chrome... I don't know.
The thing to do is probably to open yet another window for the print. Would people be opposed to that idea?