Salesforce Interview Questions – Part 10

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags , , , , with 6 Comments on Salesforce Interview Questions – Part 10

This Part of Salesforce interview question series depict on browser compatibility issue (Internet Explorer 9) and Visualforce normally for AJAX, Group By and Having Clause.


91. How to add the Document Header in Visualforce page?
Ans : Directly there is no way to add the document type in visualforce. However in most of the cases IE9 does not work with Visualforce pleasantly. And then we need to add the Document type in header. So following workaround will work.

<apex:outputText
escape="false"
value="{!'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'}"/>
<html>
    <head>
        <title>test</title>
    </head>
    <body>test</body>
</html>
</apex:page>

Read more in detail in thread – http://boards.developerforce.com/t5/Visualforce-Development/Changing-doctype-of-a-Visualforce-Page/td-p/82397/page/2


92. Onchange event does not work with <apex:actionsupport> in IE9. How to resolve this error?
Ans: If we hide the Header on Visualforce page then it creates lots of problem in IE9. I think there are few java-script library loaded by Header of Salesforce which makes IE9 compatible. So the best solution is to enable the Headre by using “showHeader=true” in Apex page.
Read more in detail in below thread URL : http://boards.developerforce.com/t5/Apex-Code-Development/IE9-requires-header-in-VF-Page/td-p/402997


93. If IE9 is not working with your custom visualforce page then how to tell your visualforce code to run in IE8 compatibility mode?
Ans:
Add following metatag to pages:

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

94. It may happen that above tips will not work as lots of time the page header already sent. then how to achieve same result using Apex?
Ans:
Add below line of code in Apex (Constructor)

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

Read more tips and tricks to solve IE9 issue in Salesforce here. Continue reading “Salesforce Interview Questions – Part 10”