Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Chrome too fast for images #2

Open
mb280sel1985 opened this Issue Feb 7, 2013 · 0 comments

Comments

Projects
None yet
1 participant

I've had trouble getting the plugin to work with chrome. The images are not loaded before the _callPrint function is called and Chrome is so quick that the images are not picked up in the preview.

The code inside function _printElement:

_callPrint(popupOrIframe);

..should be delayed until content of documentToWriteTo is done loading. The following fixed the problem:

REPLACE:

documentToWriteTo.open();
documentToWriteTo.write(html);
documentToWriteTo.close();
_callPrint(popupOrIframe);

WITH:

documentToWriteTo.onload = _callPrint(popupOrIframe);
documentToWriteTo.open();
documentToWriteTo.write(html);
documentToWriteTo.close();

..and the _callPrint function is called right after all content has been loaded inside the documentToWriteTo window document.

Note: code sequence does matter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment