Middle+
How to use the debugger in Chrome DevTools? How to set a breakpoint on a third-party website without access to source code?
sobes.tech AI
Answer from AI
In Chrome DevTools, the debugger allows you to set breakpoints to pause JavaScript execution and examine the program's state.
To set a breakpoint on a third-party website without access to the source code:
- Open DevTools (F12 or Ctrl+Shift+I).
- Go to the Sources tab.
- Find the desired script in the file list. If the code is minified, you can click the Pretty print (
{}) button to format it. - Set a breakpoint by clicking on the line number.
If the source code is unavailable or the script is loaded dynamically, you can:
- Use Event Listener Breakpoints (in the right Sources panel) — set breakpoints on specific events (e.g., clicks, loads, etc.).
- Use XHR/fetch Breakpoints to pause on network requests.
- Manually insert
debugger;via the console if you can execute code on the page.
This way, even without direct access to the source code, you can investigate the website's behavior and debug it.