<html>
<body>
<script>
// Notify opener.
window.onpageshow = function() { opener.postMessage('other-page', '*'); }

// Our opener will tell us to perform various loads.
window.addEventListener('message', function(event) {

    // Navigate first resource.
    if (event.data === 'navigate-first-page') {
        window.location = 'first-page.html';
        return;
    }

    // Navigate back.
    if (event.data === 'navigate-back') {
        window.history.back();
        return;
    }

}, false);
</script>
</body>
</html>
