comparison Applications/StoneWebViewer/WebApplication/app.js @ 1613:5f0660fe06c3

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 30 Oct 2020 11:07:38 +0100
parents 787db80a5a1b
children ad9b425f27ae
comparison
equal deleted inserted replaced
1612:228a41233540 1613:5f0660fe06c3
715 715
716 //var expectedOrigin = 'http://localhost:8042'; 716 //var expectedOrigin = 'http://localhost:8042';
717 var expectedOrigin = ''; // TODO - INSECURE - CONFIGURATION 717 var expectedOrigin = ''; // TODO - INSECURE - CONFIGURATION
718 718
719 window.addEventListener('message', function(e) { 719 window.addEventListener('message', function(e) {
720 if (expectedOrigin != '' && 720 if ('type' in e.data) {
721 e.origin !== expectedOrigin) { 721 if (expectedOrigin != '' &&
722 alert('Bad origin for the message'); 722 e.origin !== expectedOrigin) {
723 return; 723 alert('Bad origin for the message');
724 } 724 return;
725 725 }
726 if (e.data.type == 'show-osirix-annotations') { 726
727 var clear = true; // Whether to clear previous annotations 727 if (e.data.type == 'show-osirix-annotations') {
728 if ('clear' in e.data) { 728 var clear = true; // Whether to clear previous annotations
729 clear = e.data.clear; 729 if ('clear' in e.data) {
730 } 730 clear = e.data.clear;
731 731 }
732 app.LoadOsiriXAnnotations(e.data.xml, clear); 732
733 } else { 733 app.LoadOsiriXAnnotations(e.data.xml, clear);
734 alert('Unknown message type: ' + e.data.type); 734 } else {
735 alert('Unknown message type: ' + e.data.type);
736 }
735 } 737 }
736 }); 738 });
737 739
738 740
739 function Test() 741 function Test()