Use Weinre to debug mobile Web pages via PC browser

Source: Internet
Author: User

What is Weinre?
Weinre is a remote debugging tool for Web Inspector remote. For example, on a computer, you can instantly change the page element, style sheet, or view JavaScript variables on your phone, as well as see the error and warning messages on the page on your phone. Weinre as a remote debugging tool, the structure is divided into three layers: target page: The page is debugged, the page has been embedded weinre remote JS, the following will be introduced; Debug client: Local Web Inspector Debug client ; Debug service side (Agent): An HTTP Server that establishes communication with the debug client for the target page.
How to use:
(a), Nodejs build Debug Server (take Windows as an example) 1, install the node. js Installer Download: http://nodejs.org/#download安装完毕后随便打开一个cmd窗口运行 node-v Results: v0.10.32 run npm-v results: v0.10.32 indicates that the computer has NODEJS environment and NPM Package Manager to meet the installation weinre requirements. (b), install weinre cmd window run NPM install-g weinre after installation: (iii), use WEINRE for remote debugging a. Start weinre server weinre--httpport 8081--boundho St 10.12.12.213 or weinre--boundhost-all-or weinre--boundhost 10.12.12.213b. After successful operation: input display: 2015-03-11t05:39:07.109z Weinre:starting Server at http://10.12.12.213:8081 access page: http://10.12.12.213:8081/Introduce the following JS into the page to debug http://10.12.12.213:8081/target/target-script-min.js#anonymousExample:<script Src="Http://10.12.12.213:8081/target/target-script-min.js#anonymous"></script>After opening your page with your phone, you can open the Weinre debug client on the Console debug page via the PC browser (WebKit kernel). http://10.12.12.213:8081/client/#anonymous (iv), WEINRE also provides the following startup parameters:--help: Show Weinre help--httpport  [portnumber]: Set the port number used by weinre, default is 8080--boundhost  [hostname| IP Address | -all-]: Default is ' localhost ', this parameter is to restrict the devices that can access weinre server, set to-all-or specify IP, then any device can access weinre server. --verbose [True | false]: If you want to see more output on the weinre run, you can set this option to True, the default is false;--debug  [true | false]: This option is associated with--verb OSE, it will output more information. The default is False. --readtimeout [seconds]: server sends information to target/client time-out, default is 5s. --deathtimeout [seconds]: default is 3 times times the readtimeout, if the page does not have any response at this time, then the connection will be disconnected. These configurations can also create a server.properties file configuration under the Weinre root directory, as shown in the following: Httpport:8081boundhost:-all-httpport:8081reuseaddr: Truereadtimeout:1deathtimeout:5      

Use Weinre to debug mobile Web pages via PC browser

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.