javascript - Run phonegap app on chrome with Cross Domain Pages - Stack Overflow

I'm developing a phonegap app for android and I need to be able to run the app on chrome. My app d

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 0
Add a ment  | 

3 Answers 3

Reset to default 5

You 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/ ).

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745158510a4614268.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信