You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/09/22 19:55:38 UTC

[GitHub] [cordova-plugin-inappbrowser] July- opened a new issue #539: message event fires only once for one inAppBrowser window

July- opened a new issue #539: message event fires only once for one inAppBrowser window
URL: https://github.com/apache/cordova-plugin-inappbrowser/issues/539
 
 
   # Bug Report
   
   ## Problem
   message event fires only once for one inAppBrowser window
   ### What is expected to happen?
   Every time when postMessage is executed in inAppBrowser window, message would be sent and received by message event listener.
   
   
   ### What does actually happen?
   Only first message is received by message event listener.
   
   
   ## Information
   <!-- Include all relevant information that might help understand and reproduce the problem -->
   
   
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   This is code from remote web page that is opened in inAppBrowser:
   ```
   $('.share-button').on('click', function(e) {
       var href = $(this).attr('href');
        e.preventDefault();
       console.log('sending message', href);
       webkit.messageHandlers.cordova_iab.postMessage(JSON.stringify({url: href}));
       return false;
    });
   ```
   Code in application that calls inAppBrowser window and listens to message event:
   ```
   element.on('click', function(e) {
       e.preventDefault();
       var browserWindow = cordova.InAppBrowser.open(element.attr('href'), element.attr('target'), 'location=no,zoom=no');
   
       browserWindow.addEventListener('message', function(params) {
           console.log('params', params);
           if (params.data.url) {
               cordova.InAppBrowser.open(params.data.url, '_system');
           } 
       });
   
       return false;
   });
   ```
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you experiencing the issue? -->
   Platform: Android. Tested on emulator (API 26) and real device (Android 8.1) with same result.
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova: 9.0.0 (cordova-lib@9.0.1)
   
   cordova-plugin-inappbrowser 3.1.0 "InAppBrowser"
   
   Cordova platform: android 7.1.4
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org