How to use window object opener in JavaScript
In this article i will go to explain about window object opener property
Opener property in JavaScript window object
JavaScript opener property specifies the window of calling document. It returns a reference of the window that created the window.
Syntax of opener property
Browser support
The opener property is supported in all major browser.
Example of opener property
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function OpenWindow() {
myWindow = window.open('', '', 'width=200,height=100');
myWindow.document.write("<p>This is 'MyWindow'</p>");
myWindow.focus();
myWindow.opener.document.write("<p>It is the source window.</p>");
}
</script>
</head>
<body>
<input type="button" value="Open 'MyWindow'" onclick="OpenWindow()" />
</body>
</html>
|
Output:
Before clicking the button output is:
After clicking the button output is:
You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here