Actually I am trying to access Javascript
function of parent window from child window using window.opener
.Everywhere it is working fine But in iPad Chrome it does not work. Can we have a work around for this?It will be great help. Below is the detail description of my code.
I have one file test1.html(parent file)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function opentest2() {
window.open('test2.html', '_blank');
}
function parentFunction() { //This function does not execute.
alert('called from parent');
}
</script>
</head>
<body>
<input type="button" value="openanother window" onclick="opentest2()"/>
</body>
</html>
I have another file named as test2.html (child file)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
function callingchild() {
alert('hii');
alert(window.opener);
window.opener.parentFunction();
}
</script>
</head>
<body>
<input type="button" value="call parent function" onclick="callingchild()"/>
</body>
</html>
I added some alerts while debugging in iPad chrome.But the thing is that I am unable to execute this parentFunction() function. I also tried with window.parent
and window.top
but both are not working.
Thanks in advance