Skip to content

Instantly share code, notes, and snippets.

@roykolak
Created March 25, 2012 17:30
Show Gist options
  • Save roykolak/2198491 to your computer and use it in GitHub Desktop.
Save roykolak/2198491 to your computer and use it in GitHub Desktop.
postMessage example in Chrome Uber
cr.define('uber', function() {
...
function invokeMethodOnWindow(targetWindow, method, opt_params, opt_url) {
var data = {method: method, params: opt_params};
targetWindow.postMessage(data, opt_url ? opt_url : '*');
}
return {
...
invokeMethodOnWindow: invokeMethodOnWindow
};
});
...
function updateNavigationControls() {
var iframe = getSelectedIframe();
uber.invokeMethodOnWindow(navFrame.firstChild.contentWindow, 'changeSelection', {pageId: iframe.id});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment