您的位置:首页 > 移动开发

weinre调试移动端页面

2013-12-30 11:47 330 查看
1. 安装

npm install -g weinre

2. 启动
weinre --httpPort 8080 --boundHost -all-

也可以新建 ~(win: c:/user/youname)/.weinre/server.properties 内容为

boundHost: -all-
httpPort: 9090
reuseAddr: true
readTimeout: 1
deathTimeout: 5

这样以后直接输入 weinre 就行了

3. 在页面(例如:index.html)中加入

<script src="http://IP或域名:9090/target/target-script-min.js#lottery"></script>

4. 启动项目(运行项目中的tomcat等服务器)

5. 通过手机访问页面(例如:index.html)

6. 在桌面浏览器打开http:// IP 或 域名:9090/client/#lottery

可以调试了

如果觉得本地配置麻烦, 可以在http://debug.phonegap.com/配置一个自定义名称(如:codertonny), 然后在页面加入

<script src="http://debug.phonegap.com/target/target-script-min.js#codertang"></script>

当手机访问页面时, 在桌面浏览器打开http://debug.phonegap.com/client/#codertang, 就可以调试了

weinre主页http://people.apache.org/~pmuellr/weinre/docs/latest/

参考: http://thx.github.io/mobile/debugging-in-mobile/

http://js8.in/2013/11/20/%E4%BA%94%E4%B8%AA%E4%BD%A0%E5%BF%85%E9%A1%BB%E7%9F%A5%E9%81%93%E7%9A%84javascript%E5%92%8Cweb-debug%E6%8A%80%E6%9C%AF/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: