function postMessageProtocol(/*string*/ url) { // Step 1 url += '#oslc-postMessage-1.0'; // Step 2 var frame; var listener = function(e) { var HEADER = "oslc-response:"; if (e.source == frame.contentWindow && e.data.indexOf(HEADER) == 0) { // Step 4 window.removeEventListener('message', listener, false); destroyFrame(frame); handleMessage(e.data.substr(HEADER.length)); } } window.addEventListener('message', listener, false); }