Recently, I was developing a React Native project. After using the React Native Debugger, I found that I could not see the network information in the browser, which was very inconvenient. Then looked up the information, found a simple solution, by the way to share and record about ~

The first step

Add this line to the entry file (app.js)

GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest

The second step

Shut down Chrome completely. Windows recommends opening task Manager to check whether Chrome is completely shut down

The third part

MAC:

Open it directly from the command line

// Open chrome browser-a "Google Chrome"--args --disable-web-security --user-data-dir // Safari open-a '/Applications/Safari.app' --args --disable-web-security --user-data-dir
Copy the code

Windows:

First, the command line opening mode

"C:\Users\UserName\AppData\Local\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir

Two, configure the shortcut to open

Right-click the Chrome shortcut, then open Chrome Properties, type a space after Chrome.exe in the target and add

--disable-web-security --user-data-dir

Then you can see all kinds of network information in Chrome

Reference links:

1, 2, https://github.com/zhongxia245/blog/issues/28, https://github.com/facebook/react-native/issues/934Copy the code