+ Start a Discussion

Javascript refresh parent window from child not working in IE and Chrome



I am made a button on contact page to open a VF page in new window, and wish to refresh the contact page when I click Submit in the VF page.


My VF page contains iframe, so I write javascript as below 


function refreshparent()


top.window.opener.location.href= '/' + id;



on button:

<apex:commandButton action="{!Submit}" value="Submit" onComplete="refreshparent('{!Contact.Id}')"/> 


This works find in Firefox, but not working in IE neither Google Chrome, any one has ideas to help me?


Thank you very much!!!


The way I access the parent page for a popup is:


      var winMain=window.opener;
      if (null==winMain)
      // do what I need to do with winmain

This works for me across firefox, ie and chrome, though I'm hitting a javascript function embedded in a parent visualforce page rather than trying to change the location of the page.


Thanks Bob, I tried this piece of code but unfortunatly it not works for me, none of IE , Firefox or Chrome.  :(


Have you checked for javascript errors?  It might be that the browser is blocking the attempt as a cross site scripting attack.