From 7c694d784365e996694cf24f2984d73cdab43c63 Mon Sep 17 00:00:00 2001 From: Subash Date: Fri, 18 Nov 2016 13:00:36 +0530 Subject: [PATCH] Print is not working in ipad #56 Added focus to body as it is losing focus in iPad and content not getting printed Thanks to Abhishek Srivastav(abhi001) for the hint --- jQuery.print.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jQuery.print.js b/jQuery.print.js index c3031f9..7a188f0 100644 --- a/jQuery.print.js +++ b/jQuery.print.js @@ -42,6 +42,9 @@ if (!frameWindow.document.execCommand('print', false, null)) { // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891 frameWindow.print(); + }else{ + // focus body as it is losing focus in iPad and content not getting printed + $('body').focus(); } } catch (e) { frameWindow.print(); @@ -83,7 +86,7 @@ // Destroy the iframe if created here $iframe.remove(); } - }, 100); + }, 1000); }) .fail(function (err) { // Use the pop-up method if iframe fails for some reason