While developing an app with Ionic, I ran into a problem: Cordova plugins like SQLite worked perfectly on Android but wouldn’t load in Ionic View on iOS.

The problem

Cordova doesn’t load immediately in Ionic View. Ionic’s isWebView check returns false, and the app never waits for the deviceready event.

The fix

Add this line before your CSS and scripts in www/index.html:

<script>window.phonegap = {}</script>

This makes Ionic recognize that it’s running in a device context, so it properly waits for deviceready.

After uploading the modified code to Ionic View, the problem was resolved and plugins worked normally.