Would this work for getting pages loading time?
<p>Got this script that loads urls into an iframe:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    var imones = [];
    imones.push('example.com');
    imones.push('example1.com');
    imones.push('example2.com');


    $.each(imones, function (index, value) { 
        var gg="http://anyorigin.com/get?url="+imones[index]+"&amp;callback=?";
        console.log("nuorados- "+gg);

        $.getJSON(gg, function(data) {
             var iframe = $("#output")[0];
             var doc = iframe.document;

             if (iframe.contentDocument) {
                 doc = iframe.contentDocument;
             } else if (iframe.contentWindow) {
                 doc = iframe.contentWindow.document;
             }

             doc.open();
             // gets times before loading each frame
             var beforeTime = [];
             var beforeloadingtime = (new Date()).getTime();
             beforeTime.push(beforeloadingtime);
             console.log("before time- "+beforeTime);

             doc.writeln(data.contents);
             doc.close();
             //gets times after loading each frame
             var loadTime = []; 
             var loadingtime = (new Date()).getTime();
             loadTime.push(loadingtime);
             console.log("loading time- "+loadTime);
        });
    });
&lt;/script&gt;
&lt;iframe  id=output &gt;&lt;/iframe&gt;
</code></pre>

<p>I am trying to get time values /before/ loading the frame and /after/ loading the frame, for each frame. Currently I am getting these results in console running the script above:</p>

<pre><code>before time - 1362127940145 
loading time- 1362127940160 
before time - 1362127940528 
loading time- 1362127940535
before time - 1362127940573 
loading time- 1362127940584 
</code></pre>

<p><code>(loading time) - (before time) = total loading time of each frame.</code> The numbers I'm getting don't make sense because they all are very short, so i don't think im getting correct loading times here. Any suggestions how to improve this script?</p>

<p>Edit: the loading times might be correct, but I think before times need to be put somewhere else…</p>
