Using PhoneGap/Cordova on iOS with external URL

非 Y 不嫁゛ 提交于 2019-12-03 06:08:10

问题


I want my phonegap/cordova app to load an external page and nothing local.

Now that i do that , however my plugins (javascript) dont work because they are called from the local index.html.

What do i do in this case? I should put the plugins on my external URL and load them on the external index.html? Also i should also load there the cordova-2.5.0.js ?

And if this is the only way , what happens if i want to load an external page that i dont own the server , but i would like to have push notifications enabled?

How would i enable those plugins?


回答1:


d0nparalias,

Look at this project: https://dl.dropbox.com/u/930742/so/CordovaBrowserSO.zip

As you can see there is no index.html or www/ folder inside.

All files were uploaded to the server and app will download them as needed.

I've accomplished it by doing steps from p.1. from https://stackoverflow.com/a/15319156/753878 answer.

At the server I have all files that you can see in basic www/ folder created with template Cordova project:

All plugins & stuff you include directly in index.html on your server.

If you check config.xml from the archive above you'll see
<content src="http://dymv.comeze.com/www/index.html" />

And the app on launch will say:

Hope it's what you want to reach.
If it's not — please provide more info about result you want to achieve.

BR.
Eugene




回答2:


window.loadURL = function(url){
    navigator.app.loadUrl(url, { openExternal:true });
    return false;
}

to use it in a tag eg

<a href='#' onclick="window.loadUrl('http://google.com'); return false;">open</a>


来源:https://stackoverflow.com/questions/15343647/using-phonegap-cordova-on-ios-with-external-url

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