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
Martina Dimitrieva 2Martina Dimitrieva 2 

Streaming API not working on IE11

Hi,
I am getting following error in IE11 TypeError: Object doesn't support this property or method
I am using Streaming API to get notifications when an account is updated. It works on Chrome, Opera and Mozilla but not on IE11. I am not getting notifications on IE11.Does anyone know how to fix it? 
 
Best Answer chosen by Martina Dimitrieva 2
Martina Dimitrieva 2Martina Dimitrieva 2
var isIE = /*@cc_on!@*/false || !!document.documentMode;
	if(isIE)	{
		XMLHttpRequest = Sarissa.originalXMLHttpRequest;
	}

I resolved the problem. I added this to my demo.js file so can work on IE11 .
 

All Answers

Raj VakatiRaj Vakati
Can you share your code? I believe something wrong with the code.  Can you login into the workbench in IE and test it to see whether you have an issue?
Martina Dimitrieva 2Martina Dimitrieva 2
This is my page. I am using it to override the standard view page of Account. 
<apex:page standardController="Account">
  <apex:includeScript value="{!$Resource.json2_js}"/>
<script type="text/javascript" src="{!URLFOR($Resource.cometd_zip, 'dojo/dojo.js')}" data-dojo-config="async: 1"></script>
<apex:stylesheet value="{!$Resource.demo_css}"/>
<script>var token = '{!$Api.Session_ID}';
var userId = '{!$User.Id}';
var accountID = '{!Account.Id}';
</script>
     
     <script type="text/javascript" src="{!$Resource.demo_js}">
        
</script> 

   <apex:detail inlineEdit="true" relatedList="true"  />  
 

</apex:page>

And this is the demo.js file.
require(['dojo/ready', 'dojox/cometd', 'dojo/dom', 'dojo', 'dojo/query'], function(ready){
  ready(function(){

 

    var channel = null;
    var connected = false;
    var topicsubscription = false;    
    var cometd = dojox.cometd;
	
	var topic= '/topic/AccountNotify';
	
	
	
	subscribe(topic);
	

	
    function metaConnectListener(message) {
        var wasConnected = connected;
        connected = message.successful;
        if (!wasConnected && connected) {                
		subscribe(topic);	
        } else if (wasConnected && !connected) {
          
        }
    }


    function subscribe(topic) {  
        if(connected) {
			
	    if (topic == null || name.topic == 0) {
	        return;
	    }	
	    channel = topic;
	    topicsubscription = cometd.subscribe(channel, receive);	
        } else {
          
        }                
    }

    function unsubscribe() {
        if(topicsubscription) {
            cometd.unsubscribe(topicsubscription);
        }
        topicsubscription = null;
    }

    function leave() {
        unsubscribe();
     
        channel = null;
    }    

    function receive(message) {
      
        data = message.data; 
		console.log('data '+data);
		var updatedObjID = data.sobject.Id;		
		
		var updatedObjBy = data.sobject.LastModifiedById;

		if(updatedObjID === accountID && userId === data.sobject.LastModifiedById) {
			window.location.reload();
		}	
		
	
		
    }

    cometd.websocketEnabled = false;
    var auth = 'OAuth ' + token;
    var cometdURL = window.location.protocol+'//'+window.location.hostname+ (null != window.location.port ? (':'+window.location.port) : '') +'/cometd/40.0/';

    cometd.configure({
        url: cometdURL,
        requestHeaders: { Authorization: auth}
    });

    cometd.addListener('/meta/connect', metaConnectListener);

    cometd.handshake();	
  });
});
I want to refresh the page when an account is updated, I am trying to do it under Salesforce console, and it doesn't work only on IE11. 
 
Martina Dimitrieva 2Martina Dimitrieva 2
var isIE = /*@cc_on!@*/false || !!document.documentMode;
	if(isIE)	{
		XMLHttpRequest = Sarissa.originalXMLHttpRequest;
	}

I resolved the problem. I added this to my demo.js file so can work on IE11 .
 
This was selected as the best answer