Skip to content

Instantly share code, notes, and snippets.

@tobiastom
Created February 14, 2011 11:49
Show Gist options
  • Save tobiastom/825765 to your computer and use it in GitHub Desktop.
Save tobiastom/825765 to your computer and use it in GitHub Desktop.
Sample code to demonstrate communication between a javascript popup and it's opening window.
<!DOCTYPE html>
<script type="text/javascript">
if ( window.name == 'popup' ) {
document.body.className += ' in-popup'
}
function selectItemInPopup(item) {
window.opener.popupDidSelectItem(window.item);
window.close();
}
</script>
<a href="./546.html" onclick="selectItemInPopup(546); return false;">Item 546</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment