Use weinre to debug mobile web pages through a PC browser, weinrepc
What is Weinre?
Weinre stands for Web Inspector Remote and is a Remote debugging tool. For example, on a computer, you can instantly change the page elements and style sheets of the corresponding webpage on the mobile phone, or view Javascript variables. You can also see the errors and warnings on the mobile phone page. as a remote debugging tool, Weinre is structured into three layers: target page (target): the page to be debugged. The page has been embedded in weinre's remote js, which will be described below; debug client: Local Web Inspector debugging client; Debug Server (agent): an HTTP Server that establishes communication between the target page and the Debug client.
Usage:
(1) set up a debugging server for nodejs (taking windows as an example) 1. Install node. js installer download: javasnode-v result: v0.10.32 run npm-v result: v0.10.32 indicates that the computer has the nodejs environment and npm Package Manager, which meets weinre installation requirements. (2) Run npm install-g weinre in weinre cmd: (3) Use Weinre for remote debugging. start weinre server weinre -- httpPort 8081 -- boundHost 10.12.12.213 or weinre -- boundHost-all-or weinre -- boundHost 10.12.12.20. B. after running successfully, enter 2015-03-11T05: 39: 07.20.z weinre: starting server at http: // 10.12.12.213: 8081 access page: http: // 10.12.12.213: 8081/Introduce the following js to the page for debugging: 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 you open your page on your phone, you can use a PC browser (WebKit kernel) open the Weinre Debug client on the console debugging page. Http: // 10.12.12.213: 8081/client/# anonymous (4) and Weinre also provide the following startup parameters:-- Help: Display Weinre Help-- HttpPort[PortNumber]: Set the port number used by Weinre. The default value is 8080.-- BoundHost[Hostname | ip address |-all-]: The default value is 'localhost'. this parameter is used to restrict the devices that can access the Weinre Server. It is set to-all-or specify the ip address, then any device can access the Weinre Server.-- Verbose[True | false]: If you want to see more Weinre output, you can set this option to true. The default value is false;-- Debug[True | false]: similar to -- verbose, this option outputs more information. The default value is false.-- ReadTimeout[Seconds]: The timeout time for the Server to send messages to the Target/Client. The default value is 5 s.-- DeathTimeout[Seconds]: The default value is three times the value of readTimeout. If the page does not respond after this time, the connection is closed. You can also create the server. properties file configuration in the Weinre root directory. The content is as follows: httpPort: 8081 boundHost:-all-httpPort: 8081 reuseAddr: truereadTimeout: 1 deathTimeout: 5