phonegap iphone external url

匿名 (未验证) 提交于 2019-12-03 09:14:57

问题:

I'm using phonegap to create an app. I'm having a problem when I'm trying to 'include' a remote url as webpage. I have this working on Android, this was faily easy by changing the super.loadUrl();. After a while I found out that I could change the startPage (for iOS). Now I can include the remote webpage in an iOS app but phonegap doesn't seem to be loading.

No events (like the deviceready) will be called and I can't use the phonegap api.

Any help on this please?

回答1:

In order for you to be able to run PhoneGap code on an external website you will need to whitelist the website. Each platform has a different way of whitelisting. For iOS you will need to add the host in PhoneGap.plist under the "ExternalHosts" key.



回答2:

Where are you loading the PhoneGap.js file from? It won't fire the events if you are loading the JS file locally. The JS file will need to be loaded from the same page that you are loading remotely.

[EDIT] Just noticed that you said you are able to browse the same URL on Android. The PhoneGap.js file is different for Android and iOS. If you are using a common file, that could be the problem.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!