I am trying to set a delay between the time the pdf is opened and the print function is called on the pdf file. Currently nothing happens but if I move the print function outside of the setTimeout it will call the print function but this is not what I want because it is too quick and pdf has not been loaded. When I place alerts inside the setTimeout they are called fine with the specified 3 seconds.
var pdfWin = window.open(docPath);
setTimeout(function() {
pdfWin.print();
},3000)
My question is: why is the print function not being called?
Thanks in advance
Works fine for me in chrome.
Due to same-origin policy, you can only call
.print()on the window if it resides on the same domain as the parent window. Otherwise I could just open up your facebook on my page and submit some forms there ;p