0

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.

NewCodeMan
  • 227
  • 4
  • 16
  • Possible duplicate of [Calling a parent window function from an iframe](https://stackoverflow.com/questions/2161388/calling-a-parent-window-function-from-an-iframe) – Obsidian Age Aug 28 '17 at 02:46
  • A little dif title. Though I have seen and tried this one an still not working – NewCodeMan Aug 28 '17 at 02:49

0 Answers0