apache / apache/cordova-plugin-inappbrowser

PostMessage Run time error in Ios

Open
#613 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

# Bug Report
I got an type error, when I try to do post message using

webkit.messageHandlers.cordova_iab.postMessage and the error was Type error: webkit is undefined and not an object. This only occurs in ios and not in android.

## Problem
I can't able to send data back to my ionic/capacitor application.
After investigating, I have found out that this issue only present in cordova-plugin-inappbrowser v3.2.0... And this version not rise any issue with android, but cause issues with ios as I mentioned above.

So, kindly fix this issue.

### What is expected to happen?
I want to communicate with my main app when i using inappbrowser.

### What does actually happen?
I got an type error, when I try to do post message using

webkit.messageHandlers.cordova_iab.postMessage and the error was Type error: webkit is undefined and not an object. This only occurs in ios and not in android.

### Command or Code
Kindly check this git hub repo https://github.com/JoshuvaGeorge03/cordova-inappbrowser-tes
and do npm install and run `npm run release-ios` Open the cordova inappbrowser and try to do post message using `window.webkit.messageHandlers.cordova_iab.postMessage(JSON.stringify({data: 'test'}))`

and check.

### Environment, Platform, Device
Ionic:

Ionic CLI : 5.4.13 (C:\Users\Joshuva\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.11.8
@angular-devkit/build-angular : 0.803.23
@angular-devkit/schematics : 8.3.23
@angular/cli : 8.3.23
@ionic/angular-toolkit : 2.0.0

Capacitor:

Capacitor CLI : 1.4.0
@capacitor/core : 1.4.0

Utility:

cordova-res (update available: 0.8.1) : 0.3.0
native-run (update available: 0.3.0) : 0.2.2

System:

NodeJS : v10.11.0 (C:\Program Files\nodejs\node.exe)
npm : 6.13.6
OS : Windows 10

### Version information
"cordova-plugin-inappbrowser": "3.2.0",

## Checklist

- [ *] I searched for existing GitHub issues
- [* ] I updated all Cordova tooling to most recent version
- [* ] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure in the linked cordova-inappbrowser-test repository: run npm install, npm run release-ios, open the Cordova InAppBrowser, and call window.webkit.messageHandlers.cordova_iab.postMessage with the example payload. Trace the iOS handling of the cordova_iab message handler and compare it with Android. Done means the message reaches the Ionic/Capacitor app on iOS without webkit being undefined, while existing Android behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.