I am have issue closing a popup window:


<apex:commandButton value="Close" onclick="CloseAndRefresh();return:true;" id="btn"/>

<script language="JavaScript" type="text/javascript">
  function CloseAndRefresh(){

Also Popup i am calling frm Javascript button. ie:

var j$ = jQuery.noConflict(); 
var recID = '{!User.Id}'; 
var iframe_url = '{!URLFOR("/apex/mypage?Id=")}'; 
var child_domain = iframe_url.substring(0, iframe_url.indexOf('/', 9)); 
var parent_domain = window.location.protocol + '//' + window.location.host; 
var j$modalDialog = j$('<div id="opppopup"></div>') 
.html('<iframe id="iframeContentId" src="' + iframe_url +recID + '" frameborder="0" height="100%" width="100%" marginheight="0" marginwidth="0" scrolling="yes" />') 
autoOpen: false, 
title: 'popUp', 
resizable: true, 
width: 1050, 
height: 190, 
autoResize: true, 
modal: true, 
draggable: true 


Can you please guide me for above problem.

  • I had also Face same issue earlier, please make sure your development mode should be turned off. – Amit Chaudhary Jul 9 '15 at 6:53
  • Hi Amit , Its already disabled. Please let me know if I am missing anything . – Rahul Jul 9 '15 at 7:18

Hello Rahul try this Way

 function CloseAndRefresh(){

          var newWin = null;          
          newWin =window.opener.location.href="/{!$CurrentPage.parameters.id}";

           if (window.focus) {
           if (newWin != null) {

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.