[SalesForce] Not able to open Modal dialog in Chrome

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

Best Answer

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 -

1)

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 .

Related Topic