In my Visual force page when clicking on a lookup icon, I need to open a popup window to select list of available options.So I need to retrieve the value from the child window

Am using the following line of code to open a popup.

window.showModalDialog('/apex/CustomCausalityLookup', passvalue, 'dialogHeight:450px; dialogWidth:700px;');

it is working as expected in FireFox,IE & Safari but in Chrome pop up is not coming.(I have checked the Chrome browser settings and checked Allow popup option ...) While clicking on the link in Chrome am getting the following error in developer console

enter image description here

The errors are,

Uncaught TypeError: undefined is not a function AddNewCause?retURL=%2Fa05%2Fl%3FretURL%3Dhttps%253A%252F%252Fc.na15.visual.force.com%252Fapex%252FS…:76 opencausalitylookup AddNewCause?retURL=%2Fa05%2Fl%3FretURL%3Dhttps%253A%252F%252Fc.na15.visual.force.com%252Fapex%252FS…:76 onclick AddNewCause?retURL=%2Fa05%2Fl%3FretURL%3Dhttps%253A%252F%252Fc.na15.visual.force.com%252Fapex%252FS…:12

Any idea..??

Thanks Chitra

2 Answers 2


Google Chrome has stopped supporting Model dialog box More. You will have to replace your model dialog boxes with window.open in order to make it working in goggle chrome.

If you want to make inactive your parent window at the time of popup being open , you can use JQuery for that.

I have recently made these changes in my project as well.

You can open popup using below code -


window.open('Page URL'+ '?ParameterName'+ ParameterValue,"","scrollbars=1,resizable=1,Width=1420px,Height=400px,Top=180,Left=80");

2) If you want to make read only parent window then can write below code on popup window -

$(document).ready(function() { window.opener.blockUI(); })

3) If you want to make parent editable on cancel clik of client window then you can write below code -

//cancel button handler function cancelWindow() { window.opener.unBlockUI(); window.close(); return false; } jQuery(window).bind( "beforeunload", function() { window.opener.unBlockUI(); } );

4) If you want to call some parent window function from child window then you can do something like below -

window.opener.SetRole(roleId,rowNo); // SetRole is parent window function. You can also update parent window variable as well.

I have not tested syntax so might be some issue in syntaxes .

  • Thank you Pramod for your quick reply..I have wasted almost a day to fix.. Could you please elaborate your answer..I would appreciate if you give me any code samples... If I open a window using window.open whether the child window will pass the selected message to the parent window...??? Please advice..Thanks Oct 8, 2014 at 7:39
  • I have updated my post Oct 8, 2014 at 7:57
  • Wow its awesome Pramod.. window.open('Page URL'+ '?ParameterName'+ ParameterValue,"","scrollbars=1,resizable=1,Width=1420px,Height=400px,Top=180,Left=80"); this syntax working like a charm..Am able to open a popup in Chrome and in all the browsers also i need one advice from you..i need to select a value from child window and pass it to parent window..currently it returns empty value.. is there any parameter i need to mention to pass the value from child window..? Oct 8, 2014 at 9:12
  • You can declare a variable on parent window java script like - var returnValue = ""; and can set this variable value from child window like - window.opener.returnValue ="xyz" based on your requirement. Oct 8, 2014 at 10:03
  • Please up vote if it is helpful. You can also mark it best answer :) Oct 8, 2014 at 10:04

As per Promod explanation i have used the following syntax to open the popup window

window.open('Page URL'+ '?ParameterName'+ ParameterValue,"","scrollbars=1,resizable=1,Width=1420px,Height=400px,Top=180,Left=80");

And then used window.opener to access parent window properties.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .