I have an odd situation, where some of the 6000 users of an online system are getting incomplete documents printed out.
I have the following code at the bottom of the web page.
<script type="text/javascript" defer="defer">
window.onload = function(){@Html.Raw(ViewBag.StartupScript)};
</script>
and ViewBag.StartupScript is simply window.print();
Most of the users get the full document with all the images loaded. But a handful get all the text, but one or more) of the images are missing.
The images are at the bottom of the document. The images are on the same webserver (no cdn). We have to use IE or Edge for other legacy reasons. I cannot duplicate this at my workstation, I always see all the images.
The only thing I can think of is that in some cases, the network, or individual PC is slow, and so is not receiving the whole document to print it, despite the document.ready function. However, from what I understand, window.onload only fires when all the images have been loaded.
So, to keep this to questions not a discussion. Have I somehow misunderstood window.onload (and defer="defer", and the way they are used?
Is there an alternative way I can guarantee that the document and all its images are downloaded before it is printed.
And is there an easy way of proving my working theory that the print command is executed before the images are loaded?
Just to muddy the waters, it appears that the PC's this does not work on are mainly Windows 7, not windows 10 running IE. I haven't proved this definitely yet, but it may be issue in the OS / browser implementation.
To further update this (it still doesn't work properly). Some images are being aborted by ie, yet there is no consistency. Sometimes it is the first image that is aborted, other times on that page, the same image is loaded and a separate one is aborted. ((abort) in network tools. Googling this issue implies it is a mime type issue. but then I would expect it to reject or accept all mages, not act sporadically. Anyone got anymore ideas, if they are even still reading this?
` closing of body tag
– Muthu Kumaran Sep 26 '17 at 11:13