apache / apache/cordova-plugin-inappbrowser

"browser.on('loaderror')" does not work properly on iOS.

Open
#1,041 0 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

## Problem
"browser.on('loaderror')" does not work properly on iOS.

### What is expected to happen?

I have a function to handle the loaderror of my page; this function calls another function and then closes the browser:
### MyCode:
const authUrl =
`${authorizationEndpoint}?` +
`client_id=${clientId}&` +
`redirect_uri=${redirectUri}&` +
`response_type=${responseType}&` +
`scope=${scopes.join(' ')}&` +
`code_challenge=${codeChallenge}&` +
'code_challenge_method=S256';

const browser = this.inAppBrowser.create(authUrl, '_blank', {
location: 'yes',
hidenavigationbuttons: 'yes',
hideurlbar: 'yes',
},);
browser.on('loaderror').subscribe(event => {
this.MyFunction();
browser.close();
});

### What does actually happen?
The load error message appears on my screen, but the function is not executed:
![image](https://github.com/apache/cordova-plugin-inappbrowser/assets/62118491/e47d7a7e-aafd-43d1-9be5-0d099829fa56)

## Information

The same code works perfectly on Android, but on iOS, it freezes on the load error screen.

### Environment, Platform, Device
iOS: 16.6.1
Device: iPhone XR

### Version information
@ionic/cli@6.20.1
cordova@11.1.0
ios-deploy@1.12.1
cordova-plugin-inappbrowser@3.2.0

## Checklist

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

Contributor guide

Open the contributing guide

Research direction

Start from the browser.on('loaderror') subscription and the iOS load-error screen, then compare the iOS and Android event behavior in the plugin. Reproduce with the provided authUrl flow on iOS 16.6.1; done means the callback runs and browser.close() closes the browser on iOS as it does on Android.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.