I\'m the author of printThis, a jquery plugin for printing.
https://github.com/jasonday/printThis
I have a user that has brought up an issue, that I have bee
In your code, you are using setTimeout
to execute your function after the iframe has loaded.
// allow iframe to fully render before action
setTimeout ( function () {
...
}, 333 ); //333ms
but this is a mistake as you don't know if the time given is enough to load the iframe or not. Javascript execution is asynchronous so, there is no guarantee that setTimeout
will offset the execution of the function until iframe loads. Since load time is different for different pages. Some cannot execute the code properly, pointing to the line which you find to be causing errors.
var $doc = $("#" + strFrameName).contents(); //only after loading
The correct way is to use event load
or onload
to get to know if the DOM object has loaded properly or not.
//or