I have seen many answers for this on stackoverflow but none will work. Should be simple. A button in an <iframe>
calling a function on parent.
Button and function on <iframe>
<script>
function back(){
parent.test();
}
</script>
<button type="button" onClick="back()">BACK</button>
Function on parent window:
<script>
function test() {
alert("I worked!");
}
</script>
Things that I thought might be causing a problem, NONE are I tested:
- The parent window is HTML
<iframe>
is PHP- This is the 2nd iframe loaded in that orig parent iframe
I have made sample test that work perfect. Having an iframe load another iframe. Still able to call parent function. Posistion of function is right above <body>
tag on parent page and right below BTN on <iframe>
page.
All live and test files are on the same server. Something within other code on my live site must be effecting it, just have no idea what.