+ Start a Discussion
TehNrdTehNrd 

IE9, rerender, and iframes don't work

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

rtuttlertuttle

I know of a hack that would work for RichFaces by creating a filter that modifies all headers to apply the compatibility flag.  If we can get Salesforce to accept this as a defect and apply a patch during their next patch release it could be fixed with a filter.

 

See this thread on jboss forums for details:  http://community.jboss.org/thread/156720?start=15&tstart=0

 

 

-Richard

TehNrdTehNrd

That would just apply the "fix" above to all pages automatically, right?

 

I'm not sure that would fix the iframe issue. It seems IE9 is inheriting something from parent page that is preventing all the known workarounds from working.

rtuttlertuttle

On second review, add a generic controller for the frame container and move the repair code to static method in a utility class.

 

page ieiframe:

<apex:page controller="ie9fix_controller" 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>

 

class ie9fix_controller:

public class ie9fix_controller {

    //Contructor
    public ie9fix_controller(){
        // call utility class to save having to do this multiple times in multiple places
        IE9FixUtil.fixIt();
    }
    
}

utility class IE9FixUtil:

 

public class IE9FixUtil {
    public static void fixIt(){
        //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');
        }
    }
}
rtuttlertuttle

The filter would fix all pages in the org.  Filters are done in java so it'd have to be done by salesforce unfortunately.  It would simply downgrade all ie9 pages to ie8 by mass applying that compatibility into the header of every single page served up by their JVM.

 

 

-Richard

TehNrdTehNrd

My original example used an apex page to host the iframe simply because it was available, image it is not a VF page. Lets say the page hosting the iframe is not another visualforce page. It is www.mysite.com and has an iframe pointing to a sites page which is nothing more than a webform. This can't be fixed with solution above.

rtuttlertuttle

If you have the rights to edit mysite.com add the meta tag.  Make sure the meta tag is the very first meta tag on the page.  Or if your site is hosted in java or php etc modify the headers from within the host's controller/etc.

 

-Richard

TehNrdTehNrd

Yup, working with the owners of "mysite.com" now to see if this works. Unfortunetly this is out of my control. :-(

Cory CowgillCory Cowgill

Yeah, my rerender isn't working on some search apges in IE 9.

 

Has this been escalated to Salesforce Support?

joshbirkjoshbirk

An official patch was released by the Visualforce team last night, so this should no longer be an issue.  If you don't notice the fix right away, you might need to refresh/clear cache since this was a clientside issue.

Shadow666Shadow666

 

      Hi, try to change the IE security and add on trust sites/sites https:na11.salesforce.com

 

      see you.

B2000B2000

IE9 still has issues reRendering in an iFrame. Using actionSupport and actionFunction to reRender changes to fields results in inconsistant behavior. I have a checkbox that when checked, updates a date field with today’s date, and when unchecked, sets the field to null. When I cycle thru checking/unchecking the behavior operates correctly. The second time I check, the checkbox initially displays checked, then goes blank and sets the date to null. I have similar issues with selectlist reRender, but found a workaround by putting the section in an outputPanel that someone suggested and it worked.  Unfortunately it did not work for the checkbox behavior. I do not have this issue in IE8 (switching to IE8 the IE9 browser), Chrome, Firefox nor Safari. I cloned the pages and removed the iFrames and the behavior in IE9 is fine in those pages.  I have opened a case with SF but so far they want me to check my browser settings which were all set correctly.  I have given them access to SF and was disappointed they didn't even login to witness the behavior for themselves.