可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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.