In my project there are several div elements that contain onclick events like so:
<div id='main'>
<div onclick='window.open("/folder/file.php", "_self")'>
Content
</div>
<div onclick='window.open("/folder/file.php", "_self")'>
Content
</div>
<div onclick='window.open("/folder/file.php", "_self")'>
Content
</div>
<div onclick='window.open("/folder/file.php", "_self")'>
Content
</div>
</div>
Define your own function to open the URL, and have it check whether the window is a popup.
function my_open(url) {
if (window.opener) { // We're in a popup
window.opener.location = url;
} else {
window.location = url;
}
}
Then use onclick='my_open("/folder/file.php")'