Why does Cordova 2.7.0 JS seemingly no longer work on remote pages?

前端 未结 6 1583
执笔经年
执笔经年 2021-02-06 00:48

Background

I\'m attempting to upgrade an iOS app built on Cordova 2.0 to version 2.7.

It\'s basically a welcome screen that points to a remote search engine (p

6条回答
  •  無奈伤痛
    2021-02-06 01:13

    If you embed Cordova in the external web page, there will be no way to open the InAppBrowser from within your hybrid app, so Cordova will not be able to load. This is because the InAppBrowser requires Cordova to be fully loaded and initialized before it can be used to fetch a remote page. You need to use your HTML page that you have, with the as the main entry point for your app. Then you can use the InAppBrowser to open up your remote page. (You could probably do this in the onDeviceReady(), not sure if it would "flash" the page first though.) I don't think the remote page should have any Cordova code in it at all. I'm not sure if it would be possible to even interact with Cordova from the remote page due to the Same Origin Policy (probably you could use features of the InAppBrowser to inject "bridge" code though to get around this.)

提交回复
热议问题