I have a Rails 3.2 site and I am using a javascript processing routine that suddenly stopped working. Here is my print program code:
function print() {
var mywin = window.open('', '', '');
mywin.document.write('<body><link href="/assets/application.css" media="all" rel="stylesheet" type="text/css" />' + document.getElementsByClassName('fields')[0].innerHTML + '</body>');
mywin.print();
mywin.close();
return false;
}
The code has been working fine for several months, but now when you try to print it just prints two blank pages. It throws an error in the second line, cannot read the undefined property document, and the check shows that mywin is undefined.
Googling did not bring any worthwhile results, so who has a clue why this is happening?
source
share