Skip to content

remove restriction on iframe mode in Chrome; it works now #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions dist/jquery.printelement.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
/*! jQuery printElement - v2.0.1 - 2014-08-22
/*! jQuery printElement - v2.0.1 - 2016-02-17
* https://github.com/erikzaadi/jQuery.printElement
* Copyright (c) 2014 erikzaadi; Licensed MIT, GPL */
* Copyright (c) 2016 erikzaadi; Licensed MIT, GPL */
/*global window,focus,setTimeout,navigator*/
(function (window, undefined) {
var document = window.document;
var $ = window.jQuery;
$.fn.printElement = function (options) {
var mainOptions = $.extend({}, $.fn.printElement.defaults, options);
//iframe mode is not supported for opera and chrome 3.0 (it prints the entire page).
//http://www.google.com/support/forum/p/Webmasters/thread?tid=2cb0f08dce8821c3&hl=en
if (mainOptions.printMode === 'iframe') {
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
mainOptions.printMode = 'popup';
}
}
//Remove previously printed iframe if exists
$("[id^='printElement_']").remove();

Expand Down
6 changes: 3 additions & 3 deletions dist/jquery.printelement.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions src/jquery.printelement.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
var $ = window.jQuery;
$.fn.printElement = function (options) {
var mainOptions = $.extend({}, $.fn.printElement.defaults, options);
//iframe mode is not supported for opera and chrome 3.0 (it prints the entire page).
//http://www.google.com/support/forum/p/Webmasters/thread?tid=2cb0f08dce8821c3&hl=en
if (mainOptions.printMode === 'iframe') {
if (/chrome/.test(navigator.userAgent.toLowerCase())) {
mainOptions.printMode = 'popup';
}
}
//Remove previously printed iframe if exists
$("[id^='printElement_']").remove();

Expand Down