jquery - Launch javascript [ window:print() ] after page with additional javascript loaded -


i have page loading around 10 google analytics charts. launch print dialog box once page loads -- charts / javascript loaded. unfortunately, @ moment print dialog box opens after dom loaded; however, during time javascript still working on loading google charts 2-3 seconds, when print dialog box appears, areas chart should displayed coming blank.

my code @ moment this:

<script type="text/javascript">    window.onload = function() {      window.print();    } </script> 

is there way of achieving desired result print dialogue box appears after entire page (including other javascript) loads?

i sincerely appreciate suggestions may have, , thank time!

if function getting chart has callback function (i hope so, base nonimmediate functions) , if number of charts load constant can add variable var chartsloaded = 0, when chart loaded add in callback function:

chartsloaded++; if (chartsloaded == myconstantnumberofcharts)      window.print(); 

it seems simple information have given, don't hesitate give more details if problem more complex.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -