How to Take Full Page Screenshot Chrome Extension
In this article
A full page screenshot captures the entire content of a web page, including sections not visible without scrolling. This is useful for documentation, reporting bugs, or saving long articles. Chrome extensions can automate this process using the browser’s built-in APIs, allowing users to capture the complete page with a single click. To achieve this, you’ll need to create or use a Chrome extension that leverages the chrome.tabs.captureVisibleTab and html2canvas or similar tools, combined with logic to stitch scrollable content. This guide walks through building or using such an extension effectively.
What You'll Need
- A computer with Google Chrome installed
- Basic understanding of HTML, JavaScript, and JSON
- A text editor (e.g., VS Code, Sublime Text)
- Developer mode enabled in Chrome Extensions
- Optional: Node.js and npm (if using external libraries like html2canvas)
Step-by-Step
- Create a new folder for your extension. Name it something descriptive like
full-page-screenshot. - Create a manifest file named
manifest.jsoninside the folder. For Chrome extensions using Manifest V3 (required since 2023), include the following minimum content:
This grants the extension access to the active tab and allows it to inject scripts.{ "manifest_version": 3, "name": "Full Page Screenshot", "version": "1.0", "description": "Capture full page screenshots with one click.", "permissions": [ "activeTab", "scripting" ], "action": { "default_popup": "popup.html" } } - Create
popup.htmlin the same folder:
This creates a simple popup with a button to trigger the screenshot.<!DOCTYPE html> <html> <head> <style> button { width: 200px; height: 50px; font-size: 16px; margin: 10px; } </style> </head> <body> <button id="capture">Take Full Screenshot</button> <script src="popup.js"></script> </body> </html> - Create
popup.jsto handle the button click:
This script captures the full dimensions and triggers a download.document.getElementById('capture').addEventListener('click', async () => { const [tab] = await chrome.tabs.query({ active: true, currentWindow: true }); const script = { target: { tabId: tab.id }, function: fullPageScreenshot }; await chrome.scripting.executeScript(script); }); function fullPageScreenshot() { // Create a canvas large enough for the full document const canvas = document.createElement('canvas'); const context = canvas.getContext('2d'); const { width, height } = document.documentElement; canvas.width = width; canvas.height = height; // Use CSS to hide scrollbars during capture document.body.style.overflow = 'hidden'; // Render entire page to canvas (this is simplified; real implementation may use html2canvas) // For more accuracy, use a library like html2canvas via external script // Trigger download const dataURL = canvas.toDataURL('image/png'); const a = document.createElement('a'); a.href = dataURL; a.download = 'screenshot.png'; a.click(); } - Load the extension in Chrome: Go to
chrome://extensions, enable Developer mode (top right), and click "Load unpacked". Select your extension folder. - Test the extension: Navigate to any long webpage, click the extension icon, and press the "Take Full Screenshot" button. A PNG file should download.
- Improve accuracy with html2canvas (optional): Download
html2canvas.min.jsand include it in your extension. Updatemanifest.jsonto include it in"web_accessible_resources"and inject it before capture for better rendering of complex layouts.
Common Mistakes
- Using Manifest V2 instead of V3: Chrome no longer supports V2 extensions. Always use
manifest_version: 3. - Forgetting required permissions: Without
activeTabandscripting, the extension cannot access page content. - Not testing on long pages: Short pages may not reveal issues with scrolling or canvas sizing.
- Ignoring cross-origin restrictions: Extensions cannot capture content from Chrome settings or certain secure pages.
- Overlooking styling during capture: Elements like fixed headers may appear multiple times if not handled.
Tips
- Add a progress indicator in the popup for better UX on slow pages.
- Use
chrome.downloads.download()instead of simulated clicks for more reliable file saving. - Compress the image if file size is a concern (use JPEG for photos, PNG for text).
- Handle high-DPI screens by scaling canvas size using
window.devicePixelRatio. - Include error handling in JavaScript to catch failed captures gracefully.
Troubleshooting
If the screenshot fails or appears incomplete:
- No download appears: Check that popups are allowed for the extension. Also verify that the
scriptingpermission is present in the manifest. - Only visible part captured: The current method using canvas may not scroll. Implement a scroll-and-stitch technique or use
html2canvasfor full-page rendering. - Extension doesn’t load: Ensure the folder contains all required files and that there are no syntax errors in JSON or JavaScript.
- Blank or black screenshot: This can happen with WebGL or video content. Try using
chrome.tabs.captureVisibleTabwith native rendering instead. - Security error: You cannot capture Chrome Web Store, settings, or other restricted URLs. Test on regular HTTP/HTTPS sites.
Frequently Asked Questions
Can I capture password-protected pages?
Yes, as long as you’re logged in and the page is loaded in the tab. The extension runs in your browsing context.
Does this work on all websites?
Most public websites work, but some with heavy anti-bot measures may block rendering. Also, Chrome-internal pages are restricted.
Can I save screenshots directly to Google Drive?
Not directly. The extension can only trigger downloads. You’d need to manually upload to Drive unless you integrate Drive API separately.
Is it possible to capture after a delay?
Yes. Add a setTimeout in the capture function to wait before taking the screenshot, useful for dynamic content.
Why is the image blurry on high-resolution screens?
The canvas may not account for device pixel ratio. Multiply canvas dimensions by window.devicePixelRatio for sharp output.
Can the extension capture multiple tabs at once?
Not in this basic version. You’d need to modify the script to loop through tabs using chrome.tabs.query and capture each individually.