21

I've created a VF page which leverages some nice CSS 3 and HTML 5 features but it doesn't render correctly on IE10. This is not because IE10 doesn't stick to standards, but because it's reverting to an IE7 document mode, and IE7 didn't support the features I'm using.

Salesforce UI pages correctly use IE 10 Browser Mode and IE 10 Document mode, but ANYTHING that gets served up from a VF page falls back to the other mode. I've used the correct docType for HTML 5 and I've also used the following meta tag which should tell IE to use the latest mode:

<meta http-equiv="X-UA-Compatible" content="IE=10"/>

but even that doesn't do the trick. I took the generated source and tried hosting it on my own server and IE uses the correct mode there, so it seems to be related to how the page is being served up. There is a compatibility list for IE which is a list of domains for which it should use an older mode, but I can't find anything to do with force.com on there.

Has anybody encountered this and found a way around it? Short of putting everything inside a full page iFrame that's hosted elsewhere haven't found a way to get the styling correct.

2 Answers 2

24

I can't recall if it solved the exact issue you are describing, but I had an IE version compatibility issue (I think affecting IE9) which was definitely solved by adding

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

To the page initializer action and all other methods that returned PageReferences that could be null. You could try this with IE=8 and IE=10.

solution

With IE10 using the following in the controller constructor worked (didn't in the init action for some reason):

Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=10');
6
  • 2
    I had the same thing with IE9. I had to do the same thing @jkraybill did. Feb 11, 2013 at 2:28
  • I have this exact same problem. Is there any possible work around that doesn't involve a controller constructor, my visualforce pages are so simple they only use standard controllers and no extensions May 6, 2013 at 5:15
  • Not as far as I know; however it would be easy to create a generic controller extension that does this which you could add to every page.
    – jkraybill
    May 6, 2013 at 12:37
  • How do you apply this solution when it's necessary to return a null PageReference?
    – Jan Julian
    Jun 5, 2013 at 1:47
  • Are you sure it doesn't work when you return a null PageReference? I recall it working for me - ApexPages.currentPage() is not a returned PR.
    – jkraybill
    Jun 5, 2013 at 6:44
11

I also used @jkraybill's solution with a slight modification.

If you do:

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

IE will use the latest version available.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .