<body>
<script>
function makeURL(str) {
var blob = new Blob([str], { type: "text/html" });
return URL.createObjectURL(blob);
}
var ifr = document.createElement("iframe");
ifr.src = makeURL('<button onclick="parent.navigate()">Click me</button>');
document.body.appendChild(ifr);
var oldTiming;
function navigate() {
oldTiming = frames[0].performance.navigation;
ifr.src = makeURL('<button onclick="parent.doReload()">Now click me</button>');
}
function doReload() {
ifr.onload = function() { alert(oldTiming.type + " " + frames[0].performance.navigation.type); }
frames[0].location.reload();
}
</script>
<script>
function makeURL(str) {
var blob = new Blob([str], { type: "text/html" });
return URL.createObjectURL(blob);
}
var ifr = document.createElement("iframe");
ifr.src = makeURL('<button onclick="parent.navigate()">Click me</button>');
document.body.appendChild(ifr);
var oldTiming;
function navigate() {
oldTiming = frames[0].performance.navigation;
ifr.src = makeURL('<button onclick="parent.doReload()">Now click me</button>');
}
function doReload() {
ifr.onload = function() { alert(oldTiming.type + " " + frames[0].performance.navigation.type); }
frames[0].location.reload();
}
</script>