First, you need a link to open the new window with a call to the window.open()
function, passing it a URL and a target. Pass it '_blank'
to inform the browser to use a new window:
Add this link within A.aspx:
<a href="#" onclick="window.open('B.html', '_blank'); return false;">
New window
</a>
Second, you'll also need a reference to the new window's opener
, which is the window which created the new window:
Add this code within B.aspx (please replace FUNCTION_NAME()
with your function identifier) to call your parent window's function:
<script type="text/javascript">
window.opener.FUNCTION_NAME(); // Call FUNCTION_NAME() within A.aspx.
</script>
You can also access window.opener.document
to access the original window's DOM.
More information is available here:
Documentation for window.open() function
DOcumentation for window.opener object