• Shadow666
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

So clearly IE9 is causing some major headaches with Visualforce. Rerenders completely broke with IE9 but forcing the browser to run in compatibilty mode is a decent short term fix: http://boards.developerforce.com/t5/Visualforce-Development/Ajax-doesn-t-work-in-IE9/td-p/259049 . This works great.... unless the page is being served from an iframe. If it is the hack won't work and the page breaks anytime a rerender is performed. This means inline VF pages still don't have a work around and any pages you may have in other iframes won't work with IE9.

 

This is a serious problem for us as we have several webforms integrated into other sites with iframes.

 

Here is some code and pages to reproduce. This page has the IE9 hack fix and works okay.

 

http://f5.test.cs1.force.com/iebug

Page:

 

<apex:page controller="IERerenderBug" showHeader="false" standardStylesheets="false">
    <apex:form >
        <apex:commandButton value="Go" action="{!doSomething}" reRender="output" status="status"/>
        
        <apex:actionStatus id="status">
            <apex:facet name="start">
                Doing something...
            </apex:facet>
        </apex:actionStatus>
    
        <apex:outputPanel id="output">
            {!time}
        </apex:outputPanel>
    </apex:form>
</apex:page>

Controller:

 

public class IERerenderBug {

    //Contructor
    public IERerenderBug(){
        //IE9 Visualforce hack
        String browserType = Apexpages.currentPage().getHeaders().get('USER-AGENT'); //gets the browser name 
        if(browserType != null && browserType.contains('MSIE')){
            Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
        }
    }
    
    public void doSomething() {
       system.debug('something');
    }

    public Integer getTime(){
        return system.now().second();
    }

The above works fine but if that page is in an iframe somewhere else the hack does not work:

http://f5.test.cs1.force.com/IEiframe

Page:

<apex:page showHeader="false">
    This is an iframe of IEBug page... hack doesn't work if page is in an iframe.
    <iframe width="100%" height="200" frameborder="1" src="{!$Page.IEBug}"></iframe>
</apex:page

 

Does anyone know of any tricks or hacks to get this working when the page is in an iframe?

 

Thanks,

Jason

  • March 23, 2011
  • Like
  • 0