Recently tossing a night about the app on the page and debugging JS:
The first thing to do is to prepare a few more commonly used tools:
1, Chrome (this is not what you still do fe AH)
2, Fiddler (grasping the package artifact, basic is also necessary)
3, Sublime (editor must have at least one bar)
Then?
Open fiddler, configuration settings What's not here said, length a bit long, PS: (but more convenient is a thing is fiddler can be equipped with hosts, no longer hosts file down with hosts)
Here say the app inside debugging and the general M-side web debugging, the M-side debugging when the page and JS proxy to local modification is OK, but the app inside is not the same, the app inside the page and JS very stubborn, go cache go very serious, So here we briefly describe the app page and JS debugging;
Then?
If the previous tools and configuration are OK, can catch the bag normally
First, page HTML debugging
1, grasping the package: Open fiddler, use the mobile phone to access the page to be debugged, then Fiddler will catch a record, such as:
Then?
2, Ctrl+u copy out the address of the capture to chrome inside access, so you can see the phone above the page visited, then in Chrome ctrl+u can see the page source code, copy the source code out a separate page, In the Fiddler to the online access to the page agent to the local, note here we have a single page of the title change to facilitate our observation whether the agent local success:
3, we need to notice in the agent is in the app to access fiddler caught address of the last include OS and webaddress, if it is Android machine, you need to manually change the OS to iOS to properly access;
Another problem is that webaddress in every visit will change dynamically, so we do not put the webaddress=xxxxxx in the back of the agent, no, you know
4, such as the above agent successful after access to the page above the app, ... How did the page change? Of course not. We're doing the processing, changing the page display (add something to the display section of the proxy to the local HTML page), like this:
Well, the page agent is almost like this, you can modify your page locally, and the app will also have a sync with chrome changes
Then?
Second, the app JS debugging:
1, the first of your guidance you have to debug that JS, that is, the JS problem, the speed of the positioning problems need experience, rather than the whole station business logic is more familiar with the words, a look to know what is the problem, which JS out of the problem
In general, we use the Bug's view performance page element to find the corresponding ID or class, or know some of the implementation of the method name/parameter name, and then by the chrome inside the search for the corresponding JS
2, OK, find the corresponding JS and then put it agent to the local, it is necessary to note that we generally go to SVN to find the latest code down to local, and then put the JS Proxy on the line to the local,
New.js is a mclient.publish2.js down from SVN,
3, Agent Good after, in the new.js inside Dot can prove agent good code, alert () The best, why? Because the app does not recognize the console, try to look at Chrome (of course, it is also important to note here is to see if JS is really proxy to the local, We also need to do the same as HTML, in the first line of JS to do some marks, indicating that this is not the line JS), was frightened, what reaction did not have;
The JS loaded on the template is clearly:
<script type= "Text/javascript" charset= "Utf-8" src= "http://pic2.58.com/m58/app58/m_static/js/ mclient.publish2.js?cachevers=575 "></script>
It also proxies it to the Local:
Why not? This is the application of the relatively stubborn place, because the app will cache the loaded Js,app can not be as clear as the browser to clean up the cache and forced refresh, so basically is through? Plus version number to update JS (this different company Update method is different, Specific please move Zhang Yunlong Teacher's blog static Resources cache update), the version number is consistent, the app will not update this JS (will not make a request), so the proxy JS will not take effect,
The solution is to let it update, in the template to change the loaded JS version number:
OK, change it, then try it again!...... Or not, why, should everyone understand, at that time churn this when entered a misunderstanding, agent when the address with the version number 575, but the template inside the request is with the version number 576 JS, it is obvious that the agent is not successful,
Then
There are two solutions:
A, the agent when the address with the version number 575 changed to 576, this method is relatively setback, Because every time you modify the local new.js you need to see the effect of the changes you need to do two things, 1 is the template loaded in the JS version number, 2 is the need to change the agent version number and the template loaded with the JS version of the same
B, Agent time without version number:
In this case, you do not need to change the local JS every time to change the proxy JS version number, and only need to add the version number on the template is ok
Then?
End
The article is not review, wrong please point out
About the app page and JS debugging