Skip to content

Commit

Permalink
Print is not working in ipad #56
Browse files Browse the repository at this point in the history
 Added focus to body as it is losing focus in iPad and content not getting printed
Thanks to Abhishek Srivastav(abhi001) for the hint
  • Loading branch information
sselvara committed Nov 18, 2016
1 parent b236319 commit 7c694d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jQuery.print.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c694d7

Please sign in to comment.