title: Refreshing parent page refreshes child instead, Salesforce
body: <p>I have a custom button on a page in salesforce, this button triggers a js code</p>
  
  <pre><code> window.open("{!$Label.SF_Base_URL}/apex/DeletePageiFrame",300,300);
  </code></pre>
  
  <p>The DeletePageiFrame is an apex page that has an iframe(for an external website) and a button that is supposed to refresh the parent window on click.</p>
  
  <pre><code>&lt;form&gt;
  &lt;INPUT TYPE="button" NAME="myButton" onclick="handleOnClose();" value="press to close"/&gt;
  &lt;/form&gt;
  
   //the js function
  function handleOnClose() 
   {
      alert(window.parent.location); // this gives child window location instead
     window.parent.location.reload();  //refreshes child not parent  
  //  window.top.location.reload();
  
  // all the functions bellow didnt work.
   //  window.opener.location.reload(true);
    // window.opener.location.reload(false);   
     //  opener.location.reload();
     //  opener.reload();
      // window.opener.location.reload();
      // document.opener.document.location.href = document.opener.document.location.href;
  
   }
  </code></pre>
  
  <p>I also tried to trigger on window close event to call the parent window refresh but I had problems with chrome and the child window being refreshed instead of parent.</p>
  
  <pre><code>&lt;script&gt; window.onBeforeUnload=handleOnClose();&lt;/script&gt;
  </code></pre>