4

i am trying to code a chrome extension that shows the bookmarks in an html page having the name, url and thumbnail of the tab. So far i got the JS to capture the tab thumbnail in a PNG format but now i need to store it somewhere so when i open the extension's page the images could be there.

$scope.getPageThumbnail = function() { chrome.tabs.captureVisibleTab(null, {format: 'png'}, function(img) { $scope.img = img; } ); }; 

Is there a way to store images inside the extension so if the extension is removed, everything is deleted? Thank you in advance, Daniel.

2 Answers 2

1

You can store in localstorage as a data URL. Depending on how you are generating your thumbnail, you might try the Canvas toDataURL API. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

Sign up to request clarification or add additional context in comments.

Comments

0

You can use HTML5 FileSystem APIs to save your images to a target directory (say you want them inside the extension, you can create a directory with a unique id).

If your option is not limited to chrome extensions, you can write an chrome app, and then chrome.fileSystem is available to you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.