function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chitra ThambirajanChitra Thambirajan 

Not able to open modal dialog in Chrome

Hi All,

In my Visual force page while clicking on a lookup icon, I need to open a popup window to select list of available options

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 but in Chrome pop up is not coming.(I have checked the Chrome browser settings and checked Allow popup option ...)
While cliking on a link in Chrome am getting the following error in developer console

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

Any idea..??
If anyone need more info about the page am ready to give..

Thanks in advance
Chitra
Best Answer chosen by Chitra Thambirajan
Chitra ThambirajanChitra Thambirajan
Finally am able to finish this..Thanks to Pramod (http://salesforce.stackexchange.com/users/686/pramod-kumar" target="_blank)
Actually this ModalDialog is deprecated in Chrome 37..So we can not use this method to open a popup.

We need to use window.open method
window.open('Page URL'+ '?ParameterName'+ ParameterValue,"","scrollbars=1,resizable=1,Width=1420px,Height=400px,Top=180,Left=80");
This did the magic..
To assign values for parent window properties from Child window i have used window.opener
window.opener.returnValue ="xyz"
Also we can access the parent window method in child window
window.opener.setReturnedValues(values)
Thats it...

Thank you Sumit for your time.

All Answers

Sumitkumar_ShingaviSumitkumar_Shingavi
You need to right click on link and inspect element; then compare HTML compiled by Firefox and Chrome and you will get to understand where is difference. Don't forget to check console also. You might need to push more robust "Id" kind of values.

My best guess is; you are facing error because VF pages always fall on different domain "visual.force.com" and this might be cross domain referencing issue which work in Firefox but Chrome don't handle it.
Chitra ThambirajanChitra Thambirajan
Hi Sumit,

Thank you for you reply..
I just had a look on the inspect element in both browser,there is no much difference.

But in Firefox console am not getting any error.

But in Chrome am getting the following errors,

User-added image
The errors are,

Uncaught TypeError: Cannot read property 'call' of null 
https://c.na15.visual.force.com/support/console/25.0/integration.js

Uncaught TypeError: Cannot read property 'call' of null 
integration.js:132(anonymous function) integration.js:132accept xdomain.js:4Sfdc.xdomain.IframeInterface.handleOnload iframeinterface.js:1window.onload


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
Sumitkumar_ShingaviSumitkumar_Shingavi
Can you change your
https://c.na15.visual.force.com/support/console/25.0/integration.js
to
https://c.na15.visual.force.com/support/console/30.0/integration.js
So it uses latest JS APIs! Secondly, it sounds like this is cross domain issue based on "xdomain.js:4Sfdc.xdomain.IframeInterface.handleOnload iframeinterface.js:1window.onload" there.

Also Check:
1. http://salesforce.stackexchange.com/questions/8806/how-can-i-embed-a-dashboard-in-visualforce
2. http://salesforce.stackexchange.com/questions/42704/old-console-and-visualforce-pages [Disable clickjack protection for non-setup Salesforce pages]

PS: if this answers your question then hit Like and mark it as solution!
Chitra ThambirajanChitra Thambirajan
Hi Sumit,

I have changed the below reference in all the pages

https://c.na15.visual.force.com/support/console/30.0/integration.js
the error related to integration.js is gone,but still am unable to open the popup.

when i click on the lookup icon am getting the same old error in developer console

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
Thanks
Chitra
Sumitkumar_ShingaviSumitkumar_Shingavi
Is your showheader="false"? if yes then make it true and see if it works! It should, with my best guess.

PS: if this answers your question then hit Like and mark it as solution!
Chitra ThambirajanChitra Thambirajan
Sorry Sumit,this showheader value change is not fixing the issue

Thanks
Chitra
Chitra ThambirajanChitra Thambirajan
Finally am able to finish this..Thanks to Pramod (http://salesforce.stackexchange.com/users/686/pramod-kumar" target="_blank)
Actually this ModalDialog is deprecated in Chrome 37..So we can not use this method to open a popup.

We need to use window.open method
window.open('Page URL'+ '?ParameterName'+ ParameterValue,"","scrollbars=1,resizable=1,Width=1420px,Height=400px,Top=180,Left=80");
This did the magic..
To assign values for parent window properties from Child window i have used window.opener
window.opener.returnValue ="xyz"
Also we can access the parent window method in child window
window.opener.setReturnedValues(values)
Thats it...

Thank you Sumit for your time.
This was selected as the best answer