Skip to content
Aback Tools Logo

JavaScript Detector in Files

Upload any file to detect embedded JavaScript code across all common file formats. The JavaScript Detector scans PDFs for /JavaScript references and /OpenAction auto-execute triggers, Office documents (DOCX, XLSX, PPTX) for VBA macros and script elements, HTML/SVG files for inline scripts and event handlers, and any file for common JS patterns like eval(), fromCharCode(), and ActiveXObject. Results are classified by severity with auto-execute scripts flagged as critical - all processed entirely in your browser with no uploads to any server. Free online JavaScript Detector in Files, no signup required.

JavaScript Detector in Files
Upload any file to detect embedded JavaScript code. The detector scans PDFs for /JavaScript and /OpenAction triggers, Office documents for VBA macros and script elements, HTML/SVG for inline scripts and event handlers, and any file for common JavaScript patterns - all without executing code. All processing is done entirely in your browser.

Drop a file here or click to browse

Supports PDF, DOCX, XLSX, PPTX, HTML, HTM, SVG, XML - any file type supported

How the JavaScript Detector Works

The JavaScript Detector in Files scans files at the binary and structural level to find embedded JavaScript code. For PDFs, it looks for /JavaScript references, /JS inline entries, and /OpenAction auto-execute triggers. For Office documents (DOCX, XLSX, PPTX), it extracts the ZIP contents and searches for VBA macros, script elements in XML, and ActiveX controls. For HTML/SVG, it detects <script> tags, event handlers (onload, onclick, onerror), and javascript: URLs. For any file type, it performs generic pattern matching for eval(), fromCharCode(), ActiveXObject, and other JavaScript indicators. All processing runs entirely in your browser with no data uploaded to any server.

Why Use Our JavaScript Detector in Files?

Multi-Format JavaScript Detection

Detects embedded JavaScript across PDFs (via /JavaScript references, /JS entries, and OpenAction triggers), Office documents (VBA macros, script elements, ActiveX controls in DOCX/XLSX/PPTX XML), HTML/SVG files (inline scripts, event handlers, javascript: URLs), and any binary or text files with JS patterns. Comprehensive coverage for security analysis.

Execution Trigger Analysis

Identifies and classifies each detected scripts execution trigger - auto-execute actions like PDF OpenAction (runs immediately on open), onload event handlers, auto-exec macros (Auto_Open, Workbook_Open), and user-triggered events (onclick, onsubmit). Critical auto-execute scripts are flagged with severity levels for prioritised review.

Severity-Based Risk Classification

Each detected script is automatically classified with a severity level: Critical (auto-execute on open), High (embedded JavaScript/macro), Medium (event handlers, obfuscation patterns), Low (standard JS references), and Info (informational patterns). Sort and filter results to focus on the highest-risk findings first.

100% Private Browser-Based Processing

All JavaScript detection happens entirely in your browser. Files are read via the File API and analyzed locally with JSZip for Office documents and native text/binary parsing for PDFs and other formats. No data is ever uploaded to any server - your files stay completely private on your device. No signup, no account, no data collection.

Common Use Cases for JavaScript Detector in Files

Security Audit of Downloaded Files

Before opening PDFs, Office documents, or HTML files downloaded from untrusted sources, scan them for embedded JavaScript. Malicious actors use PDF JavaScript for auto-execute exploits, phishing macros in Office docs, and hidden scripts in HTML attachments. Detect and review all script content before opening.

Forensic Evidence Examination

Analyze suspicious files collected during digital investigations for embedded JavaScript that may reveal malicious intent, obfuscated payloads, or hidden execution chains. PDF OpenAction triggers, Auto_Open macros, and inline event handlers can provide critical evidence of malware delivery mechanisms.

Email Attachment Screening

Screen email attachments for embedded JavaScript before opening them. Attackers commonly embed JavaScript in PDF invoices, Office document macros, and HTML attachments to deliver malware, phishing pages, or credential harvesting scripts. The JavaScript detector helps identify risky attachments instantly.

Code & Document Supply Chain Security

Scan third-party documents, SDK packages, and vendor files for unexpected JavaScript content. Detect hidden scripts in downloaded PDF specifications, Office document templates, or HTML documentation that may contain tracking scripts, data exfiltration code, or other supply chain risks.

Malware & Phishing Analysis

Analyze suspected phishing documents for JavaScript-based obfuscation, redirect scripts, and credential harvesting code. The detector identifies common malware patterns: javascript: URLs, Base64-encoded payloads, eval() obfuscation, ActiveXObject instantiation, and WebSocket connections for data exfiltration.

Security Education & Awareness

Demonstrate how embedded JavaScript works in different file formats for security training. Show examples of PDF OpenAction exploits, Office macro auto-execution, and HTML-based phishing techniques. Help security professionals and students understand attack vectors through real detection results.

Understanding JavaScript Detection in Files

What is Embedded JavaScript in Files?

Embedded JavaScript refers to JavaScript code that is stored within non-JS file formats such as PDFs, Office documents (DOCX, XLSX, PPTX), HTML files, and SVG images. Unlike standalone .js files, embedded JavaScript is hidden inside documents and can execute automatically when the file is opened (auto-execute) or when the user interacts with document elements. This makes it a common vector for malware delivery, phishing attacks, and data exfiltration. Our JavaScript detector scans files at the binary and structural level to find, extract, and classify these embedded scripts.

How Our JavaScript Detector Works

  1. File Type Detection:The file is read and its type is identified by checking magic bytes (e.g., "%PDF-" for PDFs, "PK" for ZIP-based Office documents) and file extension. Different detection strategies are applied based on the file format to find embedded JavaScript in the most relevant locations.
  2. PDF Analysis: For PDFs, the detector searches for /JavaScript references and /JS (inline JavaScript) entries in the PDF object tree. It specifically looks for /OpenAction triggers that cause JavaScript to execute automatically when the PDF is opened in a compatible viewer. PDF JavaScript is commonly used for form validation and dynamic content but is also exploited for auto-execute malware delivery.
  3. Office Document Analysis: For DOCX, XLSX, and PPTX files (which are ZIP archives containing XML), the detector extracts the archive and scans for VBA macro entries (vbaProject.bin), script elements in document XML, ActiveX control references, and embedded HTML content. Auto-execute macros like Auto_Open, Workbook_Open, and Document_Open are flagged with critical severity.
  4. HTML/SVG/Generic Analysis: For HTML, SVG, and XML files, the detector scans for script elements, inline event handlers (onload, onclick, onerror, etc.), javascript: URLs in links and forms, and common JavaScript patterns. For all file types, a generic binary pattern search detects eval(), fromCharCode() obfuscation, ActiveXObject, innerHTML assignments, and other JavaScript indicators.

Detection Methods & Indicators

  • PDF /JavaScript References: Direct references to JavaScript actions in PDF object dictionaries. These may point to JavaScript code stored elsewhere in the PDF or reference Named Actions for execution.
  • PDF OpenAction Triggers: A specific PDF entry that defines an action to execute when the document is first opened. This is the most dangerous PDF exploit vector as it requires no user interaction. Severity: Critical.
  • Office VBA Macros: Visual Basic for Applications code embedded in Office document binaries (vbaProject.bin). Common malware delivery via Auto_Open macros that execute on document open. Severity: Critical (auto-execute) or High.
  • HTML/SVG Script Elements:Standard <script> tags embedded in HTML, SVG, or XML content within any file type. May include inline code, external references, or obfuscated payloads. Event handlers (onload, onclick, onerror) provide execution triggers.
  • Obfuscation Patterns: Common JavaScript obfuscation techniques detected include eval() calls, String.fromCharCode() encoding, Base64 (atob) decoding, and dynamic code construction. These patterns are often used to hide malicious code from static analysis tools.

Privacy, Security & Limitations

Your privacy is our priority. All file processing happens entirely within your browser using the File API for reading, JSZip for Office document inspection, and native text and binary parsing for other formats. Files are never uploaded to any server - no data leaves your device. All processing is done entirely on your device with no network requests. The tool is 100% free with no signup, no account, and no usage limits.

Important limitations: This detector performs static analysis of files and does not execute or run any detected JavaScript. It identifies script patterns, references, and structural markers but cannot determine with certainty whether a script is malicious or benign. Encrypted, compressed, or minified JavaScript may not be fully extractable. Protected PDFs (password-encrypted) and strongly obfuscated code may limit detection accuracy. Always use detected results as a starting point for further manual investigation.

Related Tools

Steganography Detector

Upload an image to detect potential hidden data using LSB (Least Significant Bit) steganography analysis. Analyzes pixel-level modifications, shows a heatmap of altered pixels, detects statistical anomalies, and extracts hidden text messages if found. Compatible with standard LSB encoding and the STEG magic header format. All processing happens locally in your browser - free online steganography detector, no signup required.

Image File Size Analyzer

Upload any image to see a detailed binary-level breakdown of what contributes to its file size - pixel data, compression overhead, metadata (EXIF/IPTC/XMP), color profiles (ICC), and structural headers. Get prioritized optimization tips with estimated savings for web performance, mobile app optimization, and storage reduction. Supports JPEG, PNG, GIF, WebP, BMP, TIFF, AVIF, and HEIC - all processing runs locally in your browser, no server upload required. Free online image file size analyzer.

File Magic Byte Detector

Upload any file to instantly detect its true file type by reading the magic bytes (file signature / header). The tool bypasses incorrect file extensions and reveals the real format. Shows hex dump with matching signature bytes highlighted, ASCII interpretation, MIME type, file category, and extension match analysis. Supports over 120 file signatures across 16 categories: images, audio, video, documents, archives, executables, fonts, certificates, disk images, and more. All processing runs locally in your browser - free online File Magic Byte Detector, no signup required.

Image Clone Detector

Detect copy-move forgeries in images using pixel-block matching. Upload any image to find cloned/copied regions, view heatmap overlays showing the location and intensity of detected clones, and get confidence scores with region details. Three sensitivity presets for different detection needs. 100% private browser-based processing - free online Image Clone Detector.

Frequently Asked Questions About JavaScript Detector in Files

The JavaScript Detector in Files is a security analysis tool that scans PDFs, Office documents (DOCX, XLSX, PPTX), HTML files, SVG images, and other file formats for embedded JavaScript code. It identifies script references, auto-execute triggers (like PDF OpenAction and Office Auto_Open macros), inline code, event handlers, and obfuscation patterns - all without executing any code. This helps security professionals, forensic analysts, and everyday users identify potentially malicious scripts hidden inside documents before opening them.

The tool supports PDF files (looking for /JavaScript, /JS, and /OpenAction entries), Office documents (DOCX, XLSX, PPTX - scanning for VBA macros, script elements in XML, ActiveX controls, and embedded HTML), HTML and HTM files (script tags, event handlers, javascript: URLs), SVG images (inline script elements, event handlers), XML files (script elements), and any other file format through generic binary pattern detection (eval(), fromCharCode(), ActiveXObject, etc.). The file type is detected automatically from magic bytes.

The JavaScript detector has built-in detection for common obfuscation patterns including eval() calls, String.fromCharCode() encoding, Base64 decoding (atob), and dynamic code construction. However, strongly obfuscated, encrypted, or compressed JavaScript may not be fully extractable through static analysis. The tool will flag the presence of obfuscation patterns even if the full decoded content cannot be determined. Always use detected results as a starting point for deeper manual investigation.

Auto-execute means the JavaScript runs automatically when the file is opened, with no user interaction required. For PDFs, this is triggered by /OpenAction entries. For Office documents, this includes macros named Auto_Open, Workbook_Open, Document_Open, and similar auto-exec triggers. These are classified as Critical severity because they represent the highest risk - opening the file in a vulnerable viewer or without proper security settings can immediately trigger the malicious code. Modern PDF viewers and Office applications have protections, but attackers continue to find bypasses.

Absolutely. All file processing happens entirely within your browser. Files are read via the File API and analyzed locally using JSZip for Office documents and native text/binary parsing for PDFs and other formats. No data is ever uploaded to any server, and no network requests are made during analysis. Your files stay completely private on your device. No signup, no account, no data collection, and no usage tracking related to your files.

PDF OpenAction is a PDF entry (/OpenAction) that defines an action to be performed automatically when the PDF is first opened. Attackers use it to trigger JavaScript execution without any user interaction - the script runs as soon as the document is rendered in a PDF viewer. Common exploits include launching phishing pages, downloading malware, or executing form-filling attacks. While modern PDF viewers like Adobe Acrobat and browser-based viewers have implemented security restrictions, OpenAction remains a common attack vector because older viewers and some third-party applications may not have these protections.

The JavaScript detector can find and display /JavaScript references and /JS (inline JavaScript) entries from PDF files. For /JS entries, it extracts the inline JavaScript code directly. For /JavaScript references that point to stream objects, it shows the reference and context. However, some PDF structures may use compressed streams, encoded data, or indirect references that make full extraction complex. The tool provides context snippets and the detected patterns - for complete extraction, consider using a dedicated PDF analysis tool in conjunction with this detector.

Yes! 100% free with no signup, no account, no API key, and no usage limits. Scan as many files as you need - completely free, forever. All processing happens in your browser with no server costs. No hidden charges, no premium tiers, and no limitations on file count, file size, or features.