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

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

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论