Use of front-end debugging tools (step on the pit road)
I. Introduction of mobile browser environment
- The androidMobile webView under Android system is currently divided into two types of kernel: native browser kernel, Tencent X5 browser kernel. Two kinds of kernel, here involves a configuration, need android native webView support debugging. As follows:
WebView.setWebContentsDebuggingEnabled(true);
This will allow us to continue with the rest of this article. If you do not have the ability to allow debugging please refer to this article:Blog.csdn.net/zhulin2609/… - IOS About webView in IOS system, all are Safari kernel, so we can do the corresponding operation next.
2. Debug Tool Introduction
- inspect
inspect
Is a remote debug directive built into Chrome that supports debugging of allMobile terminal based on chrome kernel webView
It is convenient for us to use it to link mobile phones for debugging, view command lines and network interfaces, and even interrupt points when we cannot troubleshoot problems through packet capture. It is convenient for us to debug the code and troubleshoot problems. (Note: Only used to debug Android
) - Safari Development Tools
Safari Development Tools
Inspect is a developer tool module built into the SAFARI browser on PC, which functions the same as Inspect, except that inspect provides a webView window. (Note: Only used to debug ios
)
3. Use the DEBUG tool
-
Chrome://inspect
- Adb installation passed
brew
Let’s set it upadb
Command:brew install adb
- Inspect ://inspect/# Devices go to the devices page
- Connect device Connect the Android device to be debugged via the data cable. Enable USB debugging of the device in developer mode and allow PC to debug the device
- Open the corresponding webViewchrome://inspect/#devicesPage to see the current WebView page address, click inspect, open the page debugging window can start debugging.
Note: Chrome inspect is a developer tool for Google. You need to climb the wall to access it. You need to visit https://chrome-devtools-frontend.appspot.com to download the corresponding debugging resources, so make sure that the current network environment can access this address to debug normally.
- Adb installation passed
-
Safari development tools
- Open safari developer mode to normal PC safari has development option in the menu bar, if not, please refer to the following link to setup: jingyan.baidu.com/article/6da…
- Link aN ios device Link an ios device to be debugged using a data cable
- After configuring the ios device to connect to the device, open System Settings -> Safari -> Advanced -> Web Inspector -> Open ->PC Browser click Development -> Find debugging Device -> Click For Development -> Debug Device click Trust
- Start Debugging Open the web page of the device, locate the corresponding page in the PC browser, and click debug
4. Enable TBS debugging permissions
- How to use inspect or Safari development tools to debug wechat internal pages
- Authorization, open the address debugmm.qq.com/?forcex5=tr…
- Open the debugx5.qq.com in wechat
- Click on the
information
, you can view the functions to be authorized
- How do I enable the vConsole function of the applet? Repeat step 2.3 above. Click the information and select the corresponding permission
- How do I view the current X5 kernel version and related updates
As a front-end engineer, the specific use of these debugging tools is not more verbose, I hope you slowly explore, of course, the basic function and Chrome check is the same.