From f6699ec9cb01faaec541ff091e2496e1b1bd7753 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 27 Aug 2014 12:24:28 +0200 Subject: IE postMessage fix, IE only supports Strings to be send via PostMessage use JSON Stringify and Parse to pass data --- .../src/main/resources/js/error_response.js | 2 +- simpleSigning/src/main/resources/js/pdfas.js | 23 +++++++++++----------- .../src/main/resources/js/resize_response.js | 2 +- .../src/main/resources/js/resizing_response.js | 2 +- .../src/main/resources/js/success_response.js | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) (limited to 'simpleSigning/src') diff --git a/simpleSigning/src/main/resources/js/error_response.js b/simpleSigning/src/main/resources/js/error_response.js index 8d7e5a4..a8373ff 100644 --- a/simpleSigning/src/main/resources/js/error_response.js +++ b/simpleSigning/src/main/resources/js/error_response.js @@ -6,4 +6,4 @@ var msg = { cause: "##REPLACE##CAUSE##" }; -postman.postMessage(msg, "##REPLACE##TARGETURL##", parent); \ No newline at end of file +postman.postMessage(JSON.stringify(msg), "##REPLACE##TARGETURL##", parent); \ No newline at end of file diff --git a/simpleSigning/src/main/resources/js/pdfas.js b/simpleSigning/src/main/resources/js/pdfas.js index a08d0f4..d058bec 100644 --- a/simpleSigning/src/main/resources/js/pdfas.js +++ b/simpleSigning/src/main/resources/js/pdfas.js @@ -263,18 +263,19 @@ pdfAs.doErrorCB = function(eventId, error, cause) { pdfAs.messageHandler = function(event) { if(event.origin !== pdfAsOrigin) return; - console.log('message received: ' + event.data, event); - if(event.data.suc || event.data.err) { - pdfAs.checkOverlay(event.data.eventId); - if(event.data.suc) { - console.log('Success Message: ' + event.data.suc.pdfUrl); - pdfAs.doSuccessCB(event.data.eventId, event.data.suc.pdfUrl); - } else if(event.data.err) { - console.log('Error Message: ' + event.data.err.msg); - pdfAs.doErrorCB(event.data.eventId, event.data.err.error, event.data.err.cause); + data = JSON.parse(event.data); + console.log('message received: ' + data, event); + if(data.suc || data.err) { + pdfAs.checkOverlay(data.eventId); + if(data.suc) { + console.log('Success Message: ' + data.suc.pdfUrl); + pdfAs.doSuccessCB(data.eventId, data.suc.pdfUrl); + } else if(data.err) { + console.log('Error Message: ' + data.err.msg); + pdfAs.doErrorCB(data.eventId, data.err.error, data.err.cause); } - } else if(event.data.resize) { - pdfAs.autoResize(event.data.resize, event.data.height, event.data.width); + } else if(data.resize) { + pdfAs.autoResize(data.resize, data.height, data.width); } }; diff --git a/simpleSigning/src/main/resources/js/resize_response.js b/simpleSigning/src/main/resources/js/resize_response.js index 8c67403..ef3ba0f 100644 --- a/simpleSigning/src/main/resources/js/resize_response.js +++ b/simpleSigning/src/main/resources/js/resize_response.js @@ -7,4 +7,4 @@ var msg = { width: document.body.scrollWidth }; -postman.postMessage(msg, "##REPLACE##TARGETURL##", parent); \ No newline at end of file +postman.postMessage(JSON.stringify(msg), "##REPLACE##TARGETURL##", parent); \ No newline at end of file diff --git a/simpleSigning/src/main/resources/js/resizing_response.js b/simpleSigning/src/main/resources/js/resizing_response.js index 3748a12..484c9b5 100644 --- a/simpleSigning/src/main/resources/js/resizing_response.js +++ b/simpleSigning/src/main/resources/js/resizing_response.js @@ -7,4 +7,4 @@ var msg = { width: ##REPLACE##WIDTH## }; -postman.postMessage(msg, "##REPLACE##TARGETURL##", parent); \ No newline at end of file +postman.postMessage(JSON.stringify(msg), "##REPLACE##TARGETURL##", parent); \ No newline at end of file diff --git a/simpleSigning/src/main/resources/js/success_response.js b/simpleSigning/src/main/resources/js/success_response.js index 3ad7f9a..c421537 100644 --- a/simpleSigning/src/main/resources/js/success_response.js +++ b/simpleSigning/src/main/resources/js/success_response.js @@ -7,4 +7,4 @@ var msg = { eventId: eID }; -postman.postMessage(msg, "##REPLACE##TARGETURL##", parent); \ No newline at end of file +postman.postMessage(JSON.stringify(msg), "##REPLACE##TARGETURL##", parent); \ No newline at end of file -- cgit v1.2.3