EDIT

My issue has changed.

When using EasyXDM, query strings or fragments are appened to the iFrames URL. This causes the frame to reload, rendering our analytics platform useless.

The way for getting around that is using the container property when setting up your sockets, which will just append the iFrame to the container, which fucking rocks, but I then lose the ability to add custom attributes to the iFrame or set up an event listener to it.

Any ideas on this?



Original Post

I am developing an ad management system.

I want to have the ability to communicate between Parent site A and ad management system X, across completely different domain names.

Parent site A loads iframes for advertisements, and I need to send some information up FROM the advertisement TO the parent site.

This is an OPT IN feature, so developers of Parent Site A will be allowing this communication through our Javascript API.

My issue is that 10 ads load on Parent Site A, and onload of each advertisement, I have it create a new socket and send some information up to the parent.

All of this works well at this point, but for some reason, the parent page A gets stuck in a reload loop, all of the custom/original javascript for that site keeps firing over and over and over.

Code on Parent Page A (that is from the Ad Management System JS library)

// XDM Library

var socket = new easyXDM.Socket({
    remote: 'http://adSystemX.com/serve/adcodeblahblahblah',
    onMessage: function(message, origin){
        console.log(message);
    }
});

View Raw Code →


Code inside Ad Management iFrame (ad serve)

jQuery(document).ready(function(){
    var socket = new easyXDM.Socket({
        remote: "http://parentPageA.com/",
        onMessage: function(message, origin){ },
        onReady: function(){
            socket.postMessage('My Message');
        }
    });
});

View Raw Code →


Recapping, Parent Page A seems to be executing its own custom JS over and over, leading me to believe that something of EasyXDM is causing some part of that page to reload over and over... Any ideas?

EDIT

Looking more into it, it seems that it reloads the iFrame at least once. That is an issue, how do I do what I am looking to do??