jQueryPlugins
jQueryPlugins copied to clipboard
Series of problems I fixed in Chrome Printing (Just suggestions)
I had a series of problems when printing my key element in Google Chrome.
Additional Note of Experience: If your printing elements first inner object has a top margin, a blank page will be added to your print-view because of this margin
The following is probably not the best fixes, but should be noticed by Author of this plug-in as possible areas to look for change. I'll just go through and list them as I came across them and what I edited to fix them, however, i'm currently unaware how these changes might affect other browsers as we use "Chrome-Frame" for IE users and have not yet tested for FireFox and Safari Support (too many variables I have to change, so i'm putting it off for a minute {fyi: be very careful of names in custom objects in Safari, it's very picky})
First problem was around line 169:
Problem: Css was not being included properlly because of slightly different props/attrs, so i just copied the html directly
Original Code:
html.push('<link type="text/css" rel="stylesheet" href="' + $(this).attr("href") + '" media="' + $(this).attr('media') + '" >');
MyFix: html.push($(this).clone().prop('outerHTML'));
Second Problem was around line 173:
Problem: Getting wrong base_url, I used my own get base url plugin $.myURL()
Original Code:
html.push('<base href="' + _getBaseHref() + '" />');
MyFix: html.push('<base href="' + $.myURL() + '" />');
Third Problem was around line 178:
Problem: Adding odd "undefined" div to outer of all printed html
Original Code:
html.push('<div class="' + $element.attr('class') + '">' + elementHtml + '</div>');