You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS13更新后Ionic3项目InApp Browser异常问题求助

Fixing InAppBrowser Issues in Ionic 3 After iOS 13 Update

Hey there, let's work through these two related problems you're facing with Ionic 3 and InAppBrowser post iOS 13 update—they're super common with iOS 13's WebKit changes, so we've got solid fixes for both!

1. Resolving InAppBrowser Errors After iOS 13 Update

The root cause here is almost always an outdated cordova-plugin-inappbrowser that doesn't support iOS 13's new WebKit APIs. Here's how to fix it:

  • First, uninstall the old version of the plugin from your project:
    ionic cordova plugin remove cordova-plugin-inappbrowser
    
  • Install the latest compatible version (v3.2.0 or newer works well with iOS 13):
    ionic cordova plugin add cordova-plugin-inappbrowser@latest
    
  • Double-check your config.xml to ensure the plugin is properly registered (it should be added automatically, but verification never hurts):
    <plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
    
  • Rebuild your iOS project to apply all changes:
    ionic cordova build ios
    

If errors persist, try clearing your project's build cache first with ionic cordova clean ios before rebuilding.

2. Fixing the "Please update your browser" Message in InAppBrowser

iOS 13 changed the user agent (UA) string that InAppBrowser sends, and many websites' detection logic hasn't caught up—they misidentify the InAppBrowser as an outdated browser even though it uses the latest WebKit engine. Here are three reliable fixes:

Option 1: Spoof the Safari User Agent

Modify your InAppBrowser initialization code to send a Safari UA string instead of the default one. In your Ionic 3 component/service, update the call like this:

import { InAppBrowser } from '@ionic-native/in-app-browser';

// ...

const browser = this.inAppBrowser.create('https://your-target-url.com', '_blank', {
  // Spoof a modern Safari user agent (adjust OS version to match your users' iOS version)
  userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1'
});

Option 2: Enforce WKWebView Usage

If you're still relying on the deprecated UIWebView, switching to WKWebView can resolve UA detection issues and boost performance. The latest cordova-plugin-inappbrowser uses WKWebView by default, but you can enforce it by adding this preference to your config.xml:

<preference name="InAppBrowserWebView" value="WKWebView" />

Option 3: Adjust Website Detection Logic (If You Control the Site)

If the problematic URL is your own website, update its browser detection code to recognize iOS 13+ InAppBrowser UA strings. Look for checks that block browsers containing Cordova or InAppBrowser in the UA, and whitelist those entries.


内容的提问来源于stack exchange,提问作者Gokulanathan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:19:14