Script blocking
Test JavaScript blocking with scripts hosted by this playground. No third-party services are involved.
How this fixture works
- Load a widget script without blocking. The widget should appear, Script status should read loaded, and Executions should read 1.
- Use your browser or testing tool to block script requests under this path on the current site:
/script-blocking/blocked/ - Reload the fixture and load the script again if a click is required. Wait for Ready to read true before checking the result.
When the widget script request is blocked before loading, Script status is load-error, Executions is 0, and the widget is absent.
Limit blocking to the target script requests. The control button and Fetch request should still work.
Try a scenario
A parser-inserted script runs while the HTML document loads.
Script URL: /script-blocking/blocked/widget.js?source=initial
The embedded fixture tests an iframe. Open it as a page to test the main document. If blocking is applied after a new tab opens, its first scripts may run before the rules take effect.
Assertions and diagnostics
Wait for [data-fixture-ready="true"], then assert the status, execution count, and absence of #demo-widget. These selectors are inside the fixture document.
A load error can also mean a missing file or another network failure. Inspect the network log in your browser or testing tool for errors such as net::ERR_BLOCKED_BY_CLIENT; the page cannot identify what caused a request to fail.
Fetch requests the exact same URL without executing the response. Blocking only script requests should leave it available. The fixture stylesheet and control script are served outside the target script path.