Activity Forums Salesforce® Discussions How to achieve the below given command line using Salesforce Apex?

  • shariq

    Member
    September 22, 2018 at 9:57 pm

    Add below line of code in Apex (Constructor)

    Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');

    • This reply was modified 6 years, 2 months ago by  shariq.
  • Parul

    Member
    September 23, 2018 at 4:57 am

    This will tell IE9 that you would prefer it operate like IE8, and IE8 still works fine.  However, I believe this meta tag needs to be one of the first things declared in the page, and under some situations (like showHeader=true) you may not have control over that.  In that case, you can add the following to the Apex controller:

    Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
    Remember that Apex controllers can also be served up as extensions to other custom controllers or standard controllers – so if you need to add this to several pages but don't want to rewrite the constructor of each controller, you can add one extension, place the above in the constructor – and then add the extension to existing pages without having to manipulate a lot of existing Apex.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Popular Salesforce Infographics