Thursday, 28 August 2014

Sitecore Modal Pop-ups are not working in Chrome

25 comments
Recently I’ve faced strange issue while working with Sitecore.NET 7.0. (rev. 130810) in Chrome browser.  I was trying to access presentation details of Sitecore item and layout details pop-up was not coming properly. I’ve checked Chrome console to verify if there is any JavaScript error. I’ve seen below error in Chrome console:
Uncaught ReferenceError: showModalDialog is not defined
This issue is not occurring in Sitecore 7.2 version. After troubleshooting I’ve found that this issue was occurring in Chrome version 37.x. Chrome 37 disables support for showModalDialog by default thus window.showModalDialog() won’t work anymore in Chrome 37 onwards.  For more information refer to the chromium blog. However, Google has added a temporary Group Policy setting EnableDeprecatedWebPlatformFeatures to re-enable deprecated web platform features for a limited time. In May 2015, this setting will be removed and showModalDialog will be completely removed from Chrome. Below section describes the steps to enable EnableDeprecatedWebPlatformFeatures policy setting to Chrome, which administrators can then configure via Windows Group Policy:
  1. Download ADM policy templates for Windows from here.
  2.  Unzip downloaded zip file and navigate to Start > Run: gpedit.msc
  3. Navigate to Local Computer Policy > Computer Configuration > Administrative Templates.
  4. Right-click Administrative Templates and select Add/Remove Templates.
  5. Add the downloaded chrome.adm template of Windows via the dialog for the specific language. In my case; I’ve selected adm templates for en-US locale.
  6. Once added, a Google Chrome folder will appear under 'Classic Administrative Templates' if it's not there already.
  7. Select EnableDeprecatedWebPlatformFeatures setting in right column and edit it.
  8. Edit EnableDeprecatedWebPlatformFeatures as shown in below image.
  9. Restart chrome browser and type chrome://policy/  in address bar and you will see that setting is enabled now. 
  10. Above procedure will create/update windows registry value. 
This setting doesn't need to be configured manually! Starting with Chrome 28, policies are loaded directly from the Group Policy API on Windows. Policies manually written to the registry will be ignored. Starting with Chromium 35, policies are read directly from the registry if the workstation is joined to an Active Directory domain; otherwise the policies are read from Group Policy Objects (GPO).
Order of Precedence for Chrome Policies:
Related articles:

1.) SDN Forum : showModalDialog disabled by default in Chrome 37
2.) Sitecore Knowledge Base Article

Comments and suggestions are most welcome. Happy coding!

25 comments :

  1. Please correct the link to the ADM policy templates because tight now it contains a dot at the end.

    ReplyDelete
  2. Hi Roman. Thanks for pointing the correction. I've updated the link. Cheers!

    ReplyDelete
  3. After finished all those steps, the chrome://policy/ gave me this:
    Policy name: EnableDeprecatedWebPlatformFeatures
    Policy value: ShowModelDialog_EffectiveUntil20150430
    Status: List entry "0": Value is out of range $1.
    Do you have any idea why it happened?
    Thanks,
    Harry

    ReplyDelete
  4. Hi Harry, Have you checked Windows Registry ? It should look like as attached screenshot. You can go to windows registry by Start > Run: regedit

    ReplyDelete
  5. Hi Harry, Have you checked values in Windows Registry ? It should look like as attached screenshot. You can go to windows registry by Start > Run: regedit

    ReplyDelete
  6. I have the exact same issue :(

    ModelDialog_EffectiveUntil20150430 - List entry "0": Value is out of range $1.

    ReplyDelete
  7. Hi Harry,

    It seems that there is little mistake in Policy value which you have entered. Policy value should be ShowModalDialog_EffectiveUntil20150430. Pay special attention on spelling. It is Modal.. not Model ! Hope it helps. :)

    ReplyDelete
  8. Hi Lars,

    It seems that there is little mistake in Policy value
    which you have entered. Policy value should be
    ShowModalDialog_EffectiveUntil20150430. Pay special attention on
    spelling. It is Modal.. not Model ! Hope it helps. :)

    ReplyDelete
  9. Strange. I copied the whole phrase from the description. It is correct when I checked my gpedit.msc, but resulted as Model on my regedit! I have to manually edit the regedit registry value to make it works. Not sure if this counts or not. But thank you!

    ReplyDelete
  10. Glad! It worked for you. :)

    ReplyDelete
  11. Hi, So I followed this hack and also used the corrected value of this policy etc and it works on Chrome 37 i.e. model is back on Chrome 37. Now when I upgraded to Chrome 38 Beta this key isnt working. So was this hack designed specifically for 37 only ? Or is it that since chrome 38 is beta they might not have added support for this flag yet but will probably do so before they launch 38 in live ?

    ReplyDelete