function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
osamanosaman 

Ajax doesn't work in IE9

Hi

 

My visualforce page was working fine on IE8 with ajax being used. But on IE9 it gives an error

 

 

SCRIPT16386: No such interface supported
 
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

SCRIPT16386: No such interface supported 3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 122 character 41

 

Any idea how it can be solved? 

Best Answer chosen by Admin (Salesforce Developers) 
grandersgranders

This will put the browser in IE8 mode by the way, which works for now:

 

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

All Answers

Ankit AroraAnkit Arora

Hi,

 

Please let me know after getting error does work page stop working? Or if we disable the error alerts of IE then your ajax is working properly?

 

I don't think IE9 is supported by salesforce yet.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

osamanosaman

Thanks Ankit.

 

No, the ajax request never gets completed and the page does nothing. But I can navigate to other URLs on the page if I click on them

 

Thanks

Ankit AroraAnkit Arora

Hi Osama,

 

Try using <apex:actionFunction immediate="true"/>, and let me know if error still persists.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

osamanosaman

I am already using that since I have to bypass the validations for this request.

 

Seems like its a known IE9 issue. I did talk to SF support but as usual no satisfying response from them.

 

I think there is an issue when javascript calls createElement() method on IE9.

 

Thanks

grandersgranders

I can confirm that reRender doesn't work in IE9. I have made a very simple page and controller do demonstrate the issue.

 

Page code:

 

 

<apex:page controller="IE9ReRenderTest">
<apex:form >
<apex:pageMessages ID="PageMessages" />
<apex:pageBlock title="IE9 reRender test">
<apex:pageBlockButtons >
<apex:commandButton value="Click me" action="{!clickMe}" reRender="PageMessages"/>
</apex:pageBlockButtons>
<p>Hello world!</p>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Controller code:

 

public without sharing class IE9ReRenderTest {

public void clickMe()

{

Apexpages.addMessage(new Apexpages.Message(ApexPages.Severity.INFO, 'You clicked the button!'));

}

public static testMethod void test()

{

new IE9ReRenderTest().clickMe();

}

}

 

 

The pagemessage doesn't get rendered in IE9. But it works if you change to IE8 mode.

osamanosaman

Yes I already confirmed that.

 

Thanks anyway. Appreciate it!

grandersgranders

This will put the browser in IE8 mode by the way, which works for now:

 

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

This was selected as the best answer
Bulent703Bulent703

This header trick seem to fail if you use the visualforce page as an inline page in a search layout. Is it because the header section is not included in that situation?

TehNrdTehNrd

Yup, I've noticed the same thing. If the page is in an iframe (inline) the fix above does not work.

TehNrdTehNrd

This this post was already marked as solved I've created a new one to address the iframe issue.

 

http://boards.developerforce.com/t5/Visualforce-Development/IE9-rerender-and-iframes-dont-work/td-p/260459

joshbirkjoshbirk

Took a look at this over the afternoon.  The issue, in a nutshell, if I'm understanding it, is:

 

 

  • Visualforce uses a library called Sarissa to handle faces style AJAX.
  • Until IE9, IE had no native object for serializing XML.  So when !window.XMLSerializer failed, Sarissa would point IE to its own implementation.
  • IE9 has a native XMLSerializer object, so Sarissa doesn't perform that override, and it appears IE9 doesn't bring an XSLTProcessor to the table - so the AJAX process fails when it tries to decode the result and perform the actual rerender.
A more detailed look can be found here, including some pointers to fixes - the header fix and to the Sarissa lib itself:
The header fix works because it tells IE9 you would prefer it behave like IE8.  Right now I'd say if this solution works for you, I'd use it.  It seems to me that it would incur the least risk because at the very worse you're just having your users run the browser you've presumably already tested on.
If it does not work for you, because of the inline issue or you don't have control over the headers for some reason, you might try including the following JavaScript after the intial libraries load (inline, or as part of a onLoad/onReady event).
I'm offering it merely as a stopgap until a more permanent issue can be offered, I've only had a chance to do about ten minutes worth of testing on it.  So do you your due dilligence, testing, etc.  It *does* appear to be followed with a "doesn't support this property or method" error, because of some odd log ordering in the library, but it seems to fail silently if I'm not in console.
Code is:
if(Sarissa._SARISSA_IS_IE && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5)) >=9) {
	window.XMLSerializer = function(){};
    	window.XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;}
 
    }

 

It's essentially the JavaScript fix from the link above, just inserted in a brute force manner since most of us, myself included, can't just updated the library file itself. However in my quick testing it does seem to work on the iFrame example in the other post.

 

Again: Test this thoroughly if you end up trying it. 

 

Cory CowgillCory Cowgill

Josh,

 

Thanks for the thorough description, this helps alot.

 

Has this been escalated to support?

 

I'd rather not scramble to add some hotfix to a bunch of VF pages if SF team is aware of the issue and plans to rollout a fix in the near future.

joshbirkjoshbirk

It has been escalated, the right guys are on it - but it might be a few weeks or more before a fix can be responsibly put in.  So it really depends on the urgency - if you've got a lot IE9 users running into this, I'd probably recommend being pre-emptive.  Users can also put the browser into IE8 mode, depending on their access level/rights, but obviously that might not be the most customer friendly approach.

Cory CowgillCory Cowgill

Thanks again.

 

Luckily most of the VF pages use templates, so we can just add that JS to the Template. I've done that on one site and it seems to have worked, although some of the rerendered div's aren't resizing... not sure if thats IE9 bug or existed before.

 

Regardless, the JavaScript solution has resolved the big issue of the rerender not working at all. Definetly don't want to have to force users to switch to IE8 mode, especially if these are external facing pages (Force.com Sites).

 

Looking forward to whenever SF can put in the fix.

 

r_boyd_848r_boyd_848

Testing this out I get the Object or Method not supported error as noted. This occurs on line 171 of the Sarissa Lib. Its a Debug Log statement. Is there a way to switch this off? While it does sliently fail it actually appears to abort the process. As a result using a render cause incorrect behaviour.

 

Pesudo Code:

 

public string myItem {get; set;}

public <tableOfMyItems> Items {get; set;}

 

public void AddSomething(){

 

myObject__c obj  = new myObject__c();

 

obj.name = myItem

 

insert obj;

 

}

 

 

//VF Code

 

<apex:inputText value="{!myItem}"/>

<apex:outputPanel id="rerenderMe">

 <!-- an Apex table that's rerendered with the list of myItems-->

 <apex:pageBlocktable value="tableOfMyItems" var="item">

 <apex:column value="{!item.Name}"/>

 </apex:pageBlocktable>

 

<apex:outputPanel>

 

<apex:commandButton rerender="rerenderMe" action="{!AddSomething}" value="Add Something"/>

 

What happens is that the first Item is added to the table. But when a second Item is added it overwrites the first. So while the failure in Sarissa is slient it appears to bail out at this point.

TehNrdTehNrd

@ I wasn't able to reproduce your issue. This appears to work fine.

 

Page:

 

<apex:page controller="IEbug1">
    <script>
        if(Sarissa._SARISSA_IS_IE && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5)) >=9) {
            window.XMLSerializer = function(){};
            window.XMLSerializer.prototype.serializeToString=function(oNode){return oNode.xml;}
        }
    </script> 
    
    <apex:form >
        <apex:inputText value="{!myItem}"/>
        <apex:commandButton rerender="rerenderMe" action="{!AddSomething}" value="Add Something"/><br/><br/>
        
        <apex:outputPanel id="rerenderMe">
            <apex:repeat value="{!items}" var="item">
                {!item.Name}<br />
            </apex:repeat>
        </apex:outputPanel>
    </apex:form>
</apex:page>

 

 

Controller:

 

public class IEbug1 {

    public string myItem {get; set;}
    public List <Account> items {get; set;}
   
    public IEbug1(){
        items = new List<Account>();
    }
   
    public void AddSomething(){
        Account obj  = new Account();
        obj.name = myItem;
        items.add(obj);
    }
}

 

 

-Jason

r_boyd_848r_boyd_848

Thanks, the problem I have arises on a significantly more complex page then the sample I gave. This includes a drop down list that's rendered in each table row. I suspect this is the cause I'll need to break it down. I'll post the results when I'm done.

 

 

 

 

joshbirkjoshbirk

So the second Sarissa error that IE9 gives is actually a really annoying one.  When the AJAX response is being processed, it hits this bit:

 

 

var idsSpan=req.getElementById("ajax-view-state");
LOG.debug("Hidden JSF state fields: "+idsSpan);
        

 

And IE9 chokes on the debug.  Apparently it doesn't want to append the element set, or a null, or something to the string ... not entirely sure.  When I first looked at it, I assumed it was misreporting, but after pulling the function apart and trying again, it continued reporting on the same line.  Below is that function with the debug line removed, which seems to remove the second failure as well.  Same as before, just place this somewhere it will be fired after the libraries load, but before the rerender.

 

 

Again, while these changes are lightweight - it is stil overriding a core function, test thoroughly, etc.  Also, be careful cutting and pasting ... if any of the debug lines get split it will toss out an error.

 

 

A4J.AJAX.processResponse = function (req){A4J.AJAX.TestScriptEvaluation();var options=req.options;var ajaxResponse=req.getResponseHeader('Ajax-Response');var expiredMsg=req.getResponseHeader('Ajax-Expired');if(expiredMsg&&typeof(A4J.AJAX.onExpired)=='function'){
var loc=A4J.AJAX.onExpired
(window.location,expiredMsg);if(loc){window.location=loc;return;}}
if(ajaxResponse!="true"){LOG.warn("No ajax response header ");var loc=req.getResponseHeader("Location");try{if
(ajaxResponse=='redirect'&&loc){window.location=loc;}else if(ajaxResponse=="reload"){window.location.reload(true);}else
{A4J.AJAX.replacePage(req);}}catch(e){LOG.error("Error redirect to new location ");}}else{if(req.getParserStatus()
==Sarissa.PARSED_OK){if(options.onbeforedomupdate||options.queueonbeforedomupdate){var event=req.domEvt;var data=req.getJSON
('_ajax:data');LOG.debug("Call local onbeforedomupdate function before replacing elemements");if(options.onbeforedomupdate)
{options.onbeforedomupdate(req,event,data);}
if(options.queueonbeforedomupdate){options.queueonbeforedomupdate(req,event,data);}}
var idsFromResponse=req.getResponseHeader("Ajax-Update-Ids");var ids;var callback=function(){if(A4J.AJAX.headElementsCounter!=0)
{LOG.debug("Script "+A4J.AJAX.headElementsCounter+" was loaded");--A4J.AJAX.headElementsCounter;}
if(A4J.AJAX.headElementsCounter==0){A4J.AJAX.processResponseAfterUpdateHeadElements(req,ids);}};if(options.affected)
{ids=options.affected;req.appendNewHeadElements(callback);}else if(idsFromResponse&&idsFromResponse!=""){
LOG.debug("Update page by list of rendered areas from response "+idsFromResponse);ids=idsFromResponse.split(",");req.appendNewHeadElements(callback);}else
{LOG.warn("No information in response about elements to replace");req.doFinish();}
var idsSpan=req.getElementById("ajax-view-state");if(idsSpan!=null){var namespace=options.parameters['org.ajax4jsf.portlet.NAMESPACE'];
LOG.debug("Namespace for hidden view-state input fields is "+namespace);var anchor=namespace?window.document.getElementById(namespace):window.document;var inputs=anchor.getElementsByTagName
("input");try{var newinputs=req.getElementsByTagName("input",idsSpan);A4J.AJAX.replaceViewState(inputs,newinputs);}catch(e)
{LOG.warn("No elements 'input' in response");}
try{var newinputs=req.getElementsByTagName("INPUT",idsSpan);A4J.AJAX.replaceViewState(inputs,newinputs);}catch(e){
LOG.warn("No elements 'INPUT' inresponse");}}
for(var li=0;li<A4J.AJAX._listeners.length;li++){var listener=A4J.AJAX._listeners[li];if(listener.onafterajax){var data=req.getJSON
('_ajax:data');listener.onafterajax(req,req.domEvt,data);}}
var focusId=req.getJSON("_A4J.AJAX.focus");if(focusId){LOG.debug("focus must be set to control "+focusId);var focusElement=false;if
(req.form){focusElement=req.form.elements[focusId];}
if(!focusElement){LOG.debug("No control element "+focusId+" in submitted form");focusElement=document.getElementById(focusId);}
if(focusElement){LOG.debug("Set focus to control ");focusElement.focus();if(focusElement.select)focusElement.select();}else
{LOG.warn("Element for set focus not found");}}else{LOG.debug("No focus information in response");}}
else{LOG.error("Error parsing XML");LOG.error("Parse Error: "+req.getParserStatus());}}}

 

 

 

 

TehNrdTehNrd

Eeek, that is getting deep. Still seems like the best solution is adding this to constructor:

 

 

//Force compatibiltiy mode to IE8 so page works in IE9 browsers. Official ie9 support expected Winter12 release
String browserType = Apexpages.currentPage().getHeaders().get('USER-AGENT'); 
if(browserType != null && browserType.contains('MSIE')){
    Apexpages.currentPage().getHeaders().put('X-UA-Compatible', 'IE=8');
}

 Only time this doesn't work is if your page is served from an ifram within another page as the headerss are completely ignored by IE9 and the page inherits X-UA-Compatible settings from the parent page. In this case you must add this meta tag to the parent page if you can: 

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

-Jason

 

joshbirkjoshbirk

Yeah, I'd agree with that.  I would try the HTML meta tag first, the the meta in code second, and the JavaScript last.  Overriding this kind of stuff isn't trivial, despite how small the changes might be.

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.

TehNrdTehNrd

Sweet! Thanks! So glad this made it into a patch fix and didn't get the whole IE9 isn't supported treatment.

r_boyd_848r_boyd_848

Thanks to Josh et al

TehNrdTehNrd

Heads up that I've still got pages that are braking with IE9 rerenders.

 

SCRIPT438: Object doesn't support this property or method
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 172 character 51

joshbirkjoshbirk

Odd - different line from the JS.  Is there a sample you've got I can poke at?

TehNrdTehNrd

I noticed the different line number as well.

 

Unfortunately I am seeing this on one of our most complicated pages, may take me some time to isolate but I'll look into it.

irlrobinsirlrobins

I'm also seeing the "3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript, line 172 character 51" error message in IE9.

 

I'd be interested to hear of any fix or if SFDC will be issuing a further patch.

 

Thanks

R

joshbirkjoshbirk

Can someone getting the line 172 error post a code snippet?  I wasn't seeing any errors from the earlier test code. 

stephanstephan

We've got a fix for this bug and are tentatively scheduling a fix for next week.

TehNrdTehNrd

Cool, thanks for update.

ChellappaChellappa

Hi , 

 

We are having a similar issue , but compared to yours, we have the issue in IE8 itself.

 

Surprisingly, the same code is working in one Env in IE 8.0 but not working in another salesforce environment in the same IE 8.0.

 

I am wondering what Salesforce does differently in different environments where browsers are concerned.

 

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; EasyBits GO v1.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)Timestamp: Mon, 20 Jun 2011 23:05:43 UTC

Message: Invalid argument.Line: 146Char: 96Code: 0URI: https://yahoo.qe.cs4.force.com/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript

 

This is the error we are gettign in IE 8.0

 

Regards,

Chellappa

stunaitestunaite

I have  an Standard controller extension and I added this solution line:

 

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

 

inside the constructor... nothing changed...

 

what can I do more? rerender is not working :(

Force2b_MikeForce2b_Mike

I have a client with this issue in their CS12 Sandbox (running Winter '12) . It's a brand new VF page that is in pilot. What's odd is that I can't replicate the error on my IE9, but this one user in the UK with IE9 has the issue. The debug error is "Line 205: Error: Unable to get the value of the property 'Submit':object is null or undefined". If I go into debug mode, the issue is on the line for A4J.AJAX.Submit(....). AJAX is not defined, which creates the error.

 

There are 2 buttons on the page. One with immdiate=true and one without it. The immedate=true button works fine, while the other one does not. Adding immediate=true isn't really option for the 2nd button, though I suppose worse case I can rework the page logic to allow it.

 

In the mean time, I modified the controller code to add the header line for IE=8, however that did not resolve the issue. I'd like to avoid dropping all that JavaScript into the VF page, especially since this issue was supposed to be resolved by now.

 

I'll point out that I have an identical version of IE9 installed on my home desktop and do not have this issue at all. So, I guess the question is what makes his IE9 different from my IE9?

 

Hopefully someone else has found another solution and/or Salesforce has a new pending fix.

 

 

Best Regards,

 

Mike

 

 

joshbirkjoshbirk

That you can't replicate it in IE9 and that the IE8 emulation trick doesn't work really seems to point to something outside the User Agent.  Does the user have access to another browser they can test with?  

 

Is it possible to test the page outside of Winter '12?

Force2b_MikeForce2b_Mike

Josh,

 

Thanks for the response. In talking with the client, they suspect that this persons laptop is out-of-spec. The machine was behind 69 critical updates, one or more of which could be the root cause.  I'm waiting to hear back on the status. It was in the hands of their outsourced tech service. I'll keep you posted. 

 

 

Best Regards,

 

Mike

Force2b_MikeForce2b_Mike

Josh,

 

Finally heard back from the client. Basically, they completely "reset" the computer (probably installing all pending critical updates and any other "fixes") and all is working fine now.

 

Best Regards,

 

Mike