admin管理员组文章数量:1414614
I'm developing a phonegap app for android and I need to be able to run the app on chrome. My app doesn't have any phone functionality yet. Is all Javascript, HTML and CSS.
The problem is I'm fetching some info of my server but I'm having trouble debbuging the javascript, so I wanted to test te app on the browser so I can use the developer tools, but the ajax call wont work on Chrome (It does on the phone).
Any ideas?
I'm developing a phonegap app for android and I need to be able to run the app on chrome. My app doesn't have any phone functionality yet. Is all Javascript, HTML and CSS.
The problem is I'm fetching some info of my server but I'm having trouble debbuging the javascript, so I wanted to test te app on the browser so I can use the developer tools, but the ajax call wont work on Chrome (It does on the phone).
Any ideas?
Share Improve this question asked Jan 6, 2012 at 16:48 Adrian MatteoAdrian Matteo 9871 gold badge10 silver badges28 bronze badges 03 Answers
Reset to default 5You need to run Chrome with the flag --disable-web-security
. You can either run chrome.exe --disable-web-security
from the mand line (in the appropriate directory) or edit the shortcut and add it. (Assuming you're on Windows)
If running in chrome is for testing only, jprofit's solution should be good enough. However, if users need to run it, they won't start chrome with those options :) In that case, you have two solutions
- Use JSONP ans script tags (this could be a lot of work and error handling is poor)
- Route your calls through a proxy on the local server http://developer.yahoo./javascript/howto-proxy.html, http://www.daniweb./web-development/php/code/216729
The simplest solution for me has been to use a proxy (as @juan-mendes suggests).
I use a tiny NodeJS server called Sleight, which runs locally ( http://phonegap./2010/01/20/introducing-sleight/ ).
本文标签: javascriptRun phonegap app on chrome with Cross Domain PagesStack Overflow
版权声明:本文标题:javascript - Run phonegap app on chrome with Cross Domain Pages - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745158509a2645319.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论