Use JS to get at blob-ified image listed in Chrome DevTools

  • Context: JavaScript 
  • Thread starter Thread starter Swamp Thing
  • Start date Start date
  • Tags Tags
    Image Javascript
Click For Summary
SUMMARY

JavaScript cannot access the binary data of a "blob" type image resource loaded on a web page unless the image was originally sourced from a data URI or Base64 format. In scenarios where the image is visible in Chrome DevTools but the URL is inaccessible due to server restrictions, users cannot retrieve the image data directly through JavaScript. An alternative method to obtain the image is to use Firefox Developer Tools, which allows users to download the image from the Response tab in the Network section.

PREREQUISITES
  • Understanding of JavaScript and its limitations regarding blob objects
  • Familiarity with Chrome and Firefox Developer Tools
  • Knowledge of data URIs and Base64 encoding
  • Basic concepts of web page resource loading and network requests
NEXT STEPS
  • Explore JavaScript's handling of blob objects and their limitations
  • Learn how to use Firefox Developer Tools for downloading network resources
  • Research methods for converting images to Base64 format
  • Investigate copyright implications of accessing and using web resources
USEFUL FOR

Web developers, frontend engineers, and anyone interested in manipulating image resources within web applications.

Swamp Thing
Insights Author
Messages
1,047
Reaction score
783
Can JavaScript access a "blob" type image resource that has been loaded as part of a web page, and is then visible in the Networks tab as well as under Application > Frames > Image ... ?

In the scenario I am looking at, the page is open, and the image is visible in the browser to the user. It is also available for previewing in DevTools... but the URL won't work, maybe because the server expires it soon after page load.

So I would like to get the image data in say Base64 format or in Data URI format without needing to request the URL from the server. This I would like to do by pasting code into the console.
 
Technology news on Phys.org
Swamp Thing said:
Can JavaScript access a "blob" type image resource that has been loaded as part of a web page, and is then visible in the Networks tab as well as under Application > Frames > Image ... ?

No, there is no access to the binary data forming an img from JavaScript (unless that image was originally loaded from a dataUri or Base64 src of course).

If you are intent on violating the copyright owners rights then take a screen grab. Alternatively, FireFox developer tools allows you to download the image from the Response tab in Network rather than just preview it.
 
  • Like
Likes   Reactions: Swamp Thing

Similar threads

  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 15 ·
Replies
15
Views
3K
Replies
2
Views
6K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K