Используйте window.opener
в скрипте на сайте, который вы загружаете и выполняете функцию, определенную в глобальном (!) На первой странице.
Главная страница:
<html>
<head>
<script type="text/javascript">
window.notify = function () {
alert('runned from opened window');
};
window.onload = function() {
document.getElementById('button').addEventListener('click', function() {
window.open('test.html');
}, false);
};
</script>
</head>
<body>
<button id="button">Open window</button>
</body>
Открытая страница:
<html>
<head>
<script type="text/javascript">
window.onload = function() {
window.opener.notify()
};
</script>
</head>
<body>
Popup site
</body>
</html>