Web Scraper Test Website

JavaScript Injection Detection

This page can detect if custom JavaScript was injected by the screenshot service.

Page Information

This page will check for specific variables and DOM modifications that might be set by injected JavaScript.

Injection Detection

Checking for variable 'testInjection'...
Checking for background color change...
Checking for DOM modifications...
Checking for custom data attribute...

Testing Instructions

When testing the screenshot service with this page:

  1. First take a screenshot with no JavaScript injection to establish a baseline.
  2. Then set the javascript_code parameter in your screenshot request using one of the examples below.
  3. Verify that the screenshot shows the detection results for the injected JavaScript.

Sample JavaScript Code to Inject:

// Set a test variable window.testInjection = 'This was injected!';
// Change background color document.body.style.backgroundColor = 'lightblue';
// Add a new element to the DOM const newElement = document.createElement('div'); newElement.id = 'injected-element'; newElement.innerHTML = '

This element was injected!

'; document.body.appendChild(newElement);
// Set a custom data attribute document.body.setAttribute('data-injection-test', 'success');

Sample API Request:

POST /v1.0/screenshot
{
  "url": "http://localhost:8000/detect-js",
  "javascript_code": "window.testInjection = 'This was injected!'; document.body.style.backgroundColor = 'lightblue';",
  "format": "png"
}

Current Page State

JavaScript Variables

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

Injected Content Will Appear Here:

No injected content detected.