最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using server side html+js in phonegap (multiplatform mobile dev) - Stack Overflow

programmeradmin0浏览0评论

Phonegap uses html source located in www folder. I was testing what happens if index.html is still in www, but it links to other html that are located in at the server side. It will open the server side html in the web browser instead of handle it as part of the app.

Is there any way to make phonegap work with server side html + js source?

It is not a bad idea if you need to mix usage of libraries (jars + ios libraries), local phonegap html+js with server side dynamic html code (like php output).

thanks.

Phonegap uses html source located in www folder. I was testing what happens if index.html is still in www, but it links to other html that are located in at the server side. It will open the server side html in the web browser instead of handle it as part of the app.

Is there any way to make phonegap work with server side html + js source?

It is not a bad idea if you need to mix usage of libraries (jars + ios libraries), local phonegap html+js with server side dynamic html code (like php output).

thanks.

Share Improve this question edited Jun 23, 2011 at 1:51 Kibbee 66.2k28 gold badges144 silver badges184 bronze badges asked Jun 1, 2011 at 22:10 Mariano LatorreMariano Latorre 7271 gold badge11 silver badges22 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

Phonegap is designed to deploy a client, a web app inside a native web view. You can write a server side API for returning any information your app may need and you can modify the DOM using JS. There are great templating solutions out there such as mustache.js. The idea is to write the app fully in JS and retrieve information from the server using any of Ajax implementations in your favourite JS framework. You shouldn't need any dynamic JS. Just information to template and insert into the DOM.

I can't find any reasonable explanation anywhere, but the reason why you can't invoke PhoneGap API's when html is hosted on server-side is because cross-site-scripting issue as the webkit does not allow scripts ing from one domain (i.e. server) be executed on different domain (localhost-device)

发布评论

评论列表(0)

  1. 暂无评论