btimby / ug

Web Underground browser-based website hosting platform.
MIT License
4 stars 0 forks source link

Implement a DOM mutation observer #13

Open btimby opened 3 years ago

btimby commented 3 years ago

Resources used in packaged applications need to be loaded. Since our extension is not a web server, it cannot serve up resources from http:// urls. Instead, we need to detect when an image src attribute is changed and fetch the torrent then replace the URL with a blob.

This will handle edge-cases, where resources are loaded / added by scripts and not referenced in static HTML.

To supplement this, we can pre-process HTML and CSS files, replacing image references with blobs. This would mean most cases would load without requiring the DOM mutation observer.

https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver