The code you copied *could* be OK, but at least part of it is missing (the
<script> tag around your code) so I wonder if there might be more going on
that might affect when the initialise function is called, or other things
that could affect the loader.  Could you point to the actual web page so I
can see what else might be involved in the loading process?

There is no rate limiting or throttling applied to the loader, and the
network slowness should not affect the behavior of browsers such that the
loader.js code should be loaded and executed before any subsequent scripts
are executed.

The loader was changed in the last couple weeks, but I don't believe the
changes should affect anything you are seeing, certainly nothing that is
timing related.

On Mon, Jul 1, 2019 at 6:38 AM James Handley <[email protected]> wrote:

> I have started seeing intermittent problems using Google Visualisation in
> a customer's Production environment in the last few weeks. I have made no
> code or infratructure changes.
>
> The system has been stable for 3+ years, and I cannot replicate in a
> development environment.
>
> The browser being used is Chrome.
>
>
> When trying to call
> google.charts.load('current', { 'packages': ['corechart'] });
>
> I intermittently see:
> Uncaught TypeError: Cannot read property 'load' of undefined
>     at initialise()
>
> The simplified replication code is:
>
> <html>
> <head>
> <script type="text/javascript" src="scripts/jquery-3.3.1.min.js"></script>
> <script type="text/javascript" src="
> https://www.gstatic.com/charts/loader.js";></script>
> </head>
> <body>
>
> <div id="chart">
> </div>
>
> function initialise() {
> google.charts.load('current', { 'packages': ['corechart'] });
> google.charts.setOnLoadCallback(() => {
> // .. drawing code
> };
> }
>
> $(function () {
> $('#div').load ('Content/Chart.html', function() { initialise();});
> });
>
> </body>
> </html>
>
> Unfortunately I do not currently have details of the HTTP response for the
> request to 'loader.js', but I errors in the Console have not been reported,
> except the TypeError shown above.
>
>
> My questions are:
>
>    1. Is there some sort of rate limiting/throttling applied to the
>    'loader.js' which might be causing this problem - the Production
>    environment has 1,000s of users.
>    2. Is it possible the customer's network is slow, meaning the
>    "initialise" code is being called before all the JS has loaded?
>    (I thought that using $(function () {}); would mean the code wouldn't
>    be called before the entire page had finished loading?)
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> https://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/46243bf7-52bc-450b-bab7-49ba72f6128c%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/46243bf7-52bc-450b-bab7-49ba72f6128c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJOO6QS_8i-bfL9Yf47r8fPuivefifiwhVa-7H3SxJ%3DoAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to