senthilnatarajan | Posts: 19

Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi OneSpan Team - We have a requirement where when the ESign doc is loaded in IFRAME , we need to capture events (consent accept , E sign acceptance) via the window listener, we have included the attached JS for this purpose , but seems the events (default included) in the JS are called only for the first time when the doc is loaded , any other event is not captured even for the default , Can you please help us on this. Please find attached. Regards, Danny

Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, Your attachment has an Upload Error, you can compress it into zip file and upload again. Duo

senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - Have attached the same in zip Regards, Danny

Attachments
iframe-3.zip708 bytes
Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, Please make sure that you've added below case clause into your switch statement:
				case 'ESL:MESSAGE:REGISTER':
					event.source.postMessage('ESL:MESSAGE:ACTIVATE_EVENTS', origin);
					break;
Which is used to register message listening with OneSpan Sign. Duo

senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - The case clause that you posted is already in the JS code that I had posted earlier , The JS code was downloaded from ESign site and sent as it is to you. have tried with the mentioned case clause and it is not workable. Let me know your thoughts , Do we need to register or configure some place else to get this working ? Regards, Danny

Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, Yes, I realized that what you attached was the sample code as in our code share. So it should work properly with the code without extra configurations. One thing to mention is that, these events are now supported to be monitored: DOCUMENT_ACCEPT DOCUMENT_CONFIRM PACKAGE_OPT_OUT PACKAGE_DECLINE SIGNER_COMPLETE DOCUMENT_NAVIGATION So besides document navigation, document events can only be triggered once per document, package and signer events can only be triggered once per signing, in case this was what you meant. If the issue remains, you could send screenshares of your browser console to [email protected] and potentially we can setup an online session in private. Hope this could help! Duo

senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - Thanks for your reply , yes i had tried with adding the additional mentioned events in the switch case block but not workable , Atleast I was expecting the below default case to be fired in case none of the events matched , but that too is not workable. , Will try those again and let you know. Tested by setting Log message before and after but still nothing in Logs default: % oLog.infoForced("************ Log message before " );%> event.source.postMessage(data, origin) % oLog.infoForced("************ Log message after " );%> break; Have followed the below links for testing with the events you posted https://www.esignlive.com/blog/esignlive-event-notifier https://docs.esignlive.com/content/c_integrator_s_guide/event_notifier/event_notifier.htm Regards, Danny

Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, By directly checking the console.log in browser console (F12 in browser and click console tab), what you've seen? Duo

senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - Attached the Zip file , with the console logs that i see , mentioned below few lines from the Logs. !TABTHREAD3:229 Uncaught ReferenceError: receiveMessage is not defined at !TABTHREAD3:229 i18next.js:654 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. (anonymous) @ i18next.js:654 jquery-migrate.min.js:2 JQMIGRATE: Migrate is installed, version 3.0.0 jquery.min.js?v=6885992034:4 XHR finished loading: GET "https://sandbox.esignlive.com/javascript/bower_components/intl-tel-input/lib/libphonenumber/build/utils.js" Regards, Danny

Attachments
Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, I saw there's one line in the log says "Uncaught ReferenceError: receiveMessage is not defined" and the subsequent log doesn't show any event message like "ESL:MESSAGE:REGISTER" or "ESL:MESSAGE:SUCCESS:DOCUMENT_NAVIGATION", logs like the attachment are expected. Duo

Attachments
4-3-1-1.png35.02 KB
senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - Yes went through the same , In our application logs it records for all events when the document is loaded for the first time , There is no event logged after that. As per the console logs do you have any resolution on how this can be fxied . Do we need to do any configurations at the browser level or any additional add-on ? Regards, Danny

senthilnatarajan | Posts: 19

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Duo - I am not getting the error “Uncaught ReferenceError: receiveMessage is not defined” as i placed the the call at the bottom of the script window.addEventListener('message', receiveMessage, false); but still i dont see any events getting called including the default. Regards, Danny

Duo_Liang | Posts: 3776

Reply to: Window event listener not getting called on consent and doc acceptance in IFRAME

0 votes
Hi Danny, As we discussed on online session, after two changes in code was made: (1)put the code within document.getElementById(“myIFrame”).onload(function(){…}); (2)change the parameter to “true” in window.addEventListener('message', receiveMessage, true); The notification get fired and code works properly now. Glad to help and always feel free to raise any other questions! Duo

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off