Skip to main content
100%

Gist 16d0e6050f60256517db942d1fe29703

✓ Published0🌍 Public
NN0taN3rd
Last edited Sep 11, 2018
Created on Sep 7, 2018

This example demonstrates a technique for remotely fetching and inspecting CSS stylesheets, particularly extracting image URLs from `srcset` attributes and resolving cross-origin stylesheet rules. The code uses the Fetch API with a CORS proxy to retrieve stylesheet contents, then parses `srcset` strings with a custom regular expression to collect image candidates. It also leverages `document.styleSheets`, `cssRules`, and a temporary `<style>` element to access rule data, while caching processed elements in a `WeakSet` to avoid duplication. The visualization output is logged to the console, showing the collected stylesheet rules and image URLs from the current page.

AI-generated description

Similar vizzes