Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there
I am working on this bellow html page
Where I wanted to load a div from a another html page once the page is ready I wanted the window.print() to open the print dialoag
But the it looks like the dialog open up before the div loaded with the html page.
How can I set the print dialog only open up after the div finished loading the html from the other page
Appricate your help
Below is the sample code I was working on
HTML
<html>
<head>
</head>
<body onload="window.print();">
<div> 
    <object type="text/html" data="/Estimates.htm">
    </object>
	</div>	
</body>
</html>
Posted
Updated 10-Apr-14 23:45pm
v2
Comments
Ajith K Gatty 11-Apr-14 6:38am    
It will be like that only. Body loads first and event will be fired.
rushdy20 11-Apr-14 6:54am    
but it looks the event is fired before the div finish loading what is on /Estimates.htm
Paulo Augusto Kunzel 11-Apr-14 7:19am    
When you say that "it looks the event is fired before the div finish loading what is on /Estimates.htm", is that based on some test? What and how did you test?
rushdy20 11-Apr-14 8:58am    
yes when I browser the above html I expect that the div should load the /estimate.htm before the print dialog open but that is not the case the print dialog appear before the div is populated with the text.
Try with jQuery ready event like...

$('divID').ready(function(){
// Do whatever.
});

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900