We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dfcd608 + 53238c4 commit 685b833Copy full SHA for 685b833
js/reveal.js
@@ -575,11 +575,16 @@ var Reveal = (function(){
575
576
if( config.postMessage ) {
577
window.addEventListener( 'message', function ( event ) {
578
- var data = JSON.parse( event.data );
579
- var method = Reveal[data.method];
+ var data = event.data;
580
581
- if( typeof method === 'function' ) {
582
- method.apply( Reveal, data.args );
+ // Make sure we're dealing with JSON
+ if( data.charAt( 0 ) === '{' && data.charAt( data.length - 1 ) === '}' ) {
+ data = JSON.parse( data );
583
+
584
+ // Check if the requested method can be found
585
+ if( data.method && typeof Reveal[data.method] === 'function' ) {
586
+ Reveal[data.method].apply( Reveal, data.args );
587
+ }
588
}
589
}, false );
590
0 commit comments