This page can detect if custom JavaScript was injected by the screenshot service.
This page will check for specific variables and DOM modifications that might be set by injected JavaScript.
When testing the screenshot service with this page:
javascript_code parameter in your screenshot request using one of the examples below.POST /v1.0/screenshot
{
"url": "http://localhost:8000/detect-js",
"javascript_code": "window.testInjection = 'This was injected!'; document.body.style.backgroundColor = 'lightblue';",
"format": "png"
}
| Variable | Value | Type |
|---|---|---|
| window.testInjection | undefined | undefined |
| document.body.style.backgroundColor | string | |
| document.getElementById('injected-element') | null | object |
| document.body.getAttribute('data-injection-test') | null | object |