it works beautifully locally, but when I upload it to the WordPress site, the new print window opens and flashes on/off screen instantly. Only tested with Chrome and like I said, I have no problems ’til I upload it to the server?

Javascript:

function printDiv(divName) {

"use strict";
var divToPrint = document.getElementById(divName);

var WindowObject = window.open('', 'PrintWindow', 'width=750,height=650,top=50,left=50,toolbars=no,scrollbars=yes,status=no,resizable=yes');
WindowObject.document.writeln('<!DOCTYPE html>');
WindowObject.document.writeln('<html><head><title>Your Safari Print Results</title>');
WindowObject.document.writeln('<link rel="stylesheet" id="fonts-googleapis-css"  href="http://fonts.googleapis.com/css?family=Lato%3A400%2C100%2C300%2C700%2C900&ver=4.6" type="text/css" media="all">');
WindowObject.document.writeln('<link rel="stylesheet" type="text/css" href="NewWinPrintScreen_hmap.css">');
WindowObject.document.writeln('</head><body onload="window.print()"><center><img src="logo.png" width="219" height="78"><br><div class="line"></div></center><br><br><span class="pg_title">Canine Wellness HealthMap</span>');

WindowObject.document.writeln(divToPrint.innerHTML);

WindowObject.document.writeln('</body></html>');

WindowObject.document.close();
setTimeout(function () { WindowObject.close(); }, 500);

}

Read more here: Print Window works locally, but NOT on site w/WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: