// HackTricks · Web Pentesting

Debugging Client-Side JavaScript

Debugging Client-Side JavaScript

Client-side JavaScript debugging can become repetitive when navigation or parameter changes reload the page and invalidate temporary debugging state.

debugger;

When developer tools are open, a debugger; statement pauses execution at that point unless breakpoints are disabled. Adding the statement to a persistent local copy is one way to keep the pause point across reloads.[1]

Overrides

Chrome DevTools Local Overrides stores a local replacement for a network resource and serves that replacement on subsequent page loads.[2]

  1. Open DevTools > Sources > Overrides.
  2. Select an empty local folder and allow DevTools to access it.
  3. In the Page tree, right-click the target script and select Override content or Save for overrides, depending on the Chrome version.
  4. Add debugger;, save the file, and reload the page.

Selecting a JavaScript file in the Sources panel and saving it as a local override

The saved local copy now replaces the matching network resource while overrides are enabled. Changes therefore persist across reloads, but they affect only your local browser profile.[2]

A locally overridden JavaScript file containing a debugger statement

The XSS challenge walkthrough in reference 3 demonstrates this debugger; and Local Overrides workflow during a practical client-side analysis.[3]

References

☧ CPTS · ordered posts

Locked

Unlock with your Main_Key through local GPG.

Start the local GPG helper

In your cheatsheet checkout, run:

npm run unlock:helper

Open the link it prints, or paste its pairing code below. Keep the terminal open until GPG finishes.

Import an index you already decrypted

Download the encrypted index, then decrypt with GPG:

gpg --output report-index.json --decrypt report-index.gpg

Your private key stays in GPG. The decrypted index is saved in this browser so you can reopen it after navigation, refreshes and restarts. Lock this browser or clear this site's browser data to remove the saved index. Nothing is uploaded.