Note that there are some explanatory texts on larger screens.

plurals
  1. POIframe loading time with multiple sources, 1 value is always bad
    primarykey
    data
    text
    <p>I got a script witch puts urls from a txt file into an iframe, then checks the loading time of each source. If i have 4urls in my txt file, i get 3 results witch are good enough for me, but 1 result is always too short (says frame loaded in 0,016 seconds or so, where others take 1-4 seconds to load). If i delete other urls from my list, and only leave the one that gives bad value and then run my script - i get a normal value (few seconds to load).</p> <p>Heres the script im talking about:</p> <pre><code>&lt;script type="text/javascript"&gt; $.get("imones.txt", function (data) { var array = data.split(/\r\n|\r|\n/); var beforeloadingtime = (new Date()).getTime(); var beforeTime = []; beforeTime[0] = beforeloadingtime; $.each(array, function (index, value) { var jsonnuorodos = "http://anyorigin.com/get?url=" + array[index] + "&amp;callback=?"; $.getJSON(jsonnuorodos, function (data) { var iframe = $("#frame_id")[0]; var doc = iframe.document; if (iframe.contentDocument) { doc = iframe.contentDocument; } else if (iframe.contentWindow) { doc = iframe.contentWindow.document; } doc.open(); doc.writeln(data.contents); doc.close(); var loadingtime = (new Date()).getTime(); beforeTime.push(loadingtime); for (i = 0; i &lt; array.length; i++) { var result; result = (beforeTime[i + 1] - beforeTime[i]) / 1000; $("#loadingtimediv" + i).html(result); } }); }); }); &lt;/script&gt; </code></pre> <p>Why do i get this inacurate result when running my script when i have multiple urls?</p> <p>Edit: i think my script doesnt actually wait for 1 url to load completely before adding the next one, can this be the reason im getting false results?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload