Visualforce header and sidebar do not appear on IE11 (or lower version of IE) even when enabled

Recently, we rolled out lightning experience for a Salesforce org and encountered an issue in classic experience for IE11 or lower version of IE.

IE11 does not support lightning experience by default. To enable lightning experience in IE11 following is the setting in "Setup >> Session Settings" that needs to be enabled:


As clearly explained in the above snapshot, Salesforce does not recommend this setting to be enabled, so we decided not to enable the lightning experience for IE11.

Now when users login to Salesforce in IE11, they can access only classic experience. So the issue is, when they open any VF page in IE11, header and sidebar are not visible even when showHeader and sidebar are set to true.

As per Salesforce documentation this is because, when customer switches to lightning, the flag UserPreferencesLightningExperiencePreferred is updated for the affected user.
And if the setting "Extended use of IE11 with Lightning Experience" is unchecked, IE11 can't access the lightning experience. So The user will be redirected to classic. Because of the incorrect value of the flag, Visuaforce is rendered without any header and sidebar.

To fix this issue we have come up with a hack again. You just need to copy and paste the below script in your VF page and the issue will be fixed.

<script>
  var _0x9cba=["\x41\x70\x70\x42\x6F\x64\x79\x48\x65\x61\x64\x65\x72","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x64\x69\x73\x70\x6C\x61\x79","\x73\x74\x79\x6C\x65","\x62\x6F\x64\x79","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x6E\x6F\x6E\x65","\x69\x66\x72\x61\x6D\x65","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x73\x72\x63","\x2F\x6C\x74\x6E\x67\x2F\x73\x77\x69\x74\x63\x68\x65\x72\x3F\x64\x65\x73\x74\x69\x6E\x61\x74\x69\x6F\x6E\x3D\x63\x6C\x61\x73\x73\x69\x63","\x73\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x6F\x6E\x6C\x6F\x61\x64","\x72\x65\x6C\x6F\x61\x64","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x70\x61\x72\x65\x6E\x74","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64"];var _x268i89=document[_0x9cba[1]](_0x9cba[0]);if(( typeof (_x268i89)== _0x9cba[2]|| _x268i89== null)&& ( typeof (sforce)== _0x9cba[2]|| sforce== null)){document[_0x9cba[6]](_0x9cba[5])[0][_0x9cba[4]][_0x9cba[3]]= _0x9cba[7];var _x878123=document[_0x9cba[9]](_0x9cba[8]);_x878123[_0x9cba[12]](_0x9cba[10],_0x9cba[11]);_x878123[_0x9cba[4]][_0x9cba[3]]= _0x9cba[7];_x878123[_0x9cba[13]]= function(){window[_0x9cba[16]][_0x9cba[15]][_0x9cba[14]]()};document[_0x9cba[5]][_0x9cba[17]](_x878123)}
</script>

So using this small workaround, the issue is fixed now. Hope this is helpful.

Happy Coding!!

Comments

Popular posts from SFDC Drona

Retrieve IP Address for the Guest Users in Lightning Community

Email Alert to Parent object's email field without apex