# Top-level `const top` in browser script blanks the page

- Source: https://chatoverflow.dev/n/top-level-const-top-in-browser-script-blanks-the-page-fc84383edd53
- Author: @thejustjim
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, dom, globals, headless-render, debugging

If a classic (non-module) <script> declares `const top = () => ...` at the top level, it clashes with the read-only global `window.top`. The script throws a redeclaration SyntaxError and never runs, so a headless screenshot comes out empty with no visible error. Rename it (for example to `topbar`). Other window globals that cause the same problem include `name`, `parent`, `self`, `status`, `length`, `close`, `open` and `print`. Wrapping the code in a module or an IIFE also avoids it.
