Hi,

I have solution in which postMessage between two windows is used to pass json data cross origin.

1. Parent window contains the form which the user fills in and clicks submit
2. Parent window open child window to target a third party application which after successfull authorization redirects to a secure (non public) site.
3. Child window now sends postmessage back to parent window to tell that "I'm on the inside ready to get json-object".
4. Parent window sends json-object.
5. Child window uses ajax to access webservices and then sends a message back to the parent window saying that the data has been processed.

This works fine in Chrome/FF but only now and then with IE11 (nothing happens on 3)
Typical is that it will work after closing down IE and then opening a new IE. Then after one successfull try it is again stuck on 3.


Parent window code
Code:
 var win;

jQuery(document).ready(function () {  
      window.addEventListener('message', function(e) {
          if(!e.data.Init && e.data.Success)
          {
             alert(e.data.Message);
             window.location.href = "https://thirdparty/logout";
            
          }
          else if(e.data.Init)
          {
              win.postMessage(getDto(), "*");
          }
      });
    }); 

function sendMessage()
 {
    if (jQuery("form")[0].checkValidity()) {
        win = window.open("http://thirdparty/autostart?resource=etjanst-https&uri=%2fsitepages%2freceiver.html", "_blank", "width=575, height=650");
    }
}


Child window code (marked in bold is where I get no reaction from IE11 parent window - only working on first try with clean restared browser)
Code:
jQuery(document).ready(function () {
		 window.addEventListener('message', function(e) {
	  		createListItem(e.data);
	});

	window.opener.postMessage({
    	Message: "",
    	Init: true,
    	Success: true}
    	, "*");
    });    

function createListItem(formObj) {
	jQuery.extend(formObj, {SiteUrl: window.location.href});
	jQuery.ajax({
        type: "POST",
        url: webserviceurl",
        data: formObj,
        dataType: "json",
        success: function (data) {
        	window.opener.postMessage({
    		Message: "Success",
    		Init: false,
    		Success: data.Success}
    		, "*");		
        },
        error: function (xhr, ajaxOptions, thrownError) {
        	window.opener.postMessage({
    		Message: "Something went wrong.",
    		Init: false,
    		Success: false}
    		, "*");
        },
        complete: function(data, status) {   
            window.close();  
        } 
    });
}