I have been trying to load a custom javascript to be loaded in all my alfresco pages.
I need to add a listener, so an external application can access the current url loaded at alfresco using an iframe.
The listener would be something like this: (copied from this question)
window.addEventListener('message', function(event) {
    // IMPORTANT: Check the origin of the data!
    if (~event.origin.indexOf('http://yoursite.com')) {
        // The data has been sent from your site
        // The data sent with postMessage is stored in event.data
        console.log(event.data);
    } else {
        // The data hasn't been sent from your site!
        // Be careful! Do not use it.
        return;
    }
});
It can be either appended at every page or loaded as an external .js file.
Thanks for your time.
 
     
    