Getting The Load Time Of Each Iframe With Multiple Sources December 19, 2023 Post a Comment I am trying to get the loadtime of each iframe, and then display the time. Here is the code i currently have (without the loading time calculations): Solution 1: How about this: $(document).ready(function(){ var array = ['http://www.example1.com', 'http://www.example2.com', 'http://www.example3.com']; var beforeLoad = (newDate()).getTime(); var loadTimes = []; $('#1').on('load', function() { loadTimes.push((newDate()).getTime()); $('#1').attr('src', array.pop()); if (array.length === 0) { $.each(loadTimes, function(index, value) { alert(value - beforeLoad); }); } }).attr('src', array.pop()); }); Copysidenote You have to be sure you can access the websites you are checking by an iframe because most websites nowadays disallow iframes. if you still want to measure loads without iframes and use javascript you can perhaps use $.get requests to imitate the same thing. Share Post a Comment for "Getting The Load Time Of Each Iframe With Multiple Sources"
Post a Comment for "Getting The Load Time Of Each Iframe With Multiple Sources"