We use a modified version of Jiffy to measure actual client-side performance.
The most important thing we do is measure the time between when the request was received and when the page load event fires in the browser.
On some pages we have iframe elements that point to external sites that we don’t control – they sometimes take a long while to load. At the moment, the page load event for our page fires only after the iframe is completely loaded (and it’s own load event fires).
I’d like to separate these measurements – have one measurement after everything including the iframe is loaded, but also one measurement without the iframe – that is, when the page load would have occured if we didn’t have an iframe.
The only way I’ve managed to do this so far is to add the iframe to the DOM after the page load event, but that delays the loading of the iframe.
Any ideas?
EDIT: bounty is over, thanks for the help and ideas! I chose Jed’s answer because it gave me a new idea – start loading the iframes, but “pause” them so they won’t affect page load (by temporarily setting src="about:blank"). I’ll try to add a more detailed summary of my results.
You can achieve this for multiple iframes without dynamically adding them by:
srcattribute for all frames toabout:blankbefore body load,onloadhandler to capture the load time of each frame, and thensrcattribute of each frame to its original value.I’ve created a
frameTimermodule that consists of two methods:initmethod that needs to be called immediately before the</body>tag, andmeasuremethod to be called on page load, which takes a callback with the results.The results object is a hash like this:
It returns integers for each load time, but could be easily changed to just return the diff from the document body load.
Here’s a working example of it in action, with this javascript file (
frameTimer.js):and this html file (
frameTimer.html):This could be done in a lot less code (and less obtrusively) with jQuery, but this is a pretty lightweight and dependency-free attempt.