Drupal 11 Link Directory Part 2 Adds REST API and Chrome Extension Workflow

Browser-based screenshots replace unreliable headless Chromium captures in the tutorial series.
Drupal 11 Link Directory Tutorial Adds REST API and Chrome Extension Screenshot Workflow

Hashbang Code has published the second part of Philip Norton’s Drupal 11 link directory series, moving screenshot capture from headless Chromium to a browser-extension workflow. Philip Norton writes that CDN blocks, captcha checks, and cookie popups made automated headless screenshots unreliable, with many captures returning error pages instead of the intended site.

The article follows Part 1 of the series, which covered setting up a Drupal 11 link directory and taking screenshots as links were added. The DropTimes previously summarised that opening article in its coverage of Drupal link directory screenshots. Part 2 replaces that screenshot mechanism with a custom REST resource and a Chrome extension named Link It.

On the Drupal side, the tutorial describes a REST resource that accepts POST requests and creates or updates a Link content entity from submitted link, title, and base64 image data. Philip uses the Key Auth module for authentication, with requests first calling /session/token before sending the returned CSRF token and API key to the link creation endpoint. The post also covers a controlled SecKit bypass that uses a custom Hashbangcode-Extension header while allowing normal SecKit behaviour for unrecognised requests.

The Chrome extension uses manifest.json, a popup interface, a background service worker, and Chrome debugger permissions to capture the active tab at a fixed 1280x960 size. Philip notes that the workflow still has limits, including occasional tiled or corrupted captures when the browser window is smaller than the target size. The article includes code examples for the REST resource, SecKit handling, extension files, screenshot capture, and submission flow, and should be read directly for implementation details.

Disclosure: This content is produced with the assistance of AI.

Disclaimer: The opinions expressed in this story do not necessarily represent that of TheDropTimes. We regularly share third-party blog posts that feature Drupal in good faith. TDT recommends Reader's discretion while consuming such content, as the veracity/authenticity of the story depends on the blogger and their motives. 

Note: The vision of this web portal is to help promote news and stories around the Drupal community and promote and celebrate the people and organizations in the community. We strive to create and distribute our content based on these content policy. If you see any omission/variation on this please reach out to us at #thedroptimes channel on Drupal Slack and we will try to address the issue as best we can.

Related Organizations

Related People

Upcoming Events

Latest Opportunities