Where to save informations from Chrome Extension and retrieve it? - google-chrome-extension

I have finished with developing main mechanism of my Chrome Extension but I need to do final step and enable saving informations that extension gets. I already saw that chrome.fileSystem API allows this but it can't be used with extensions and using chrome.storage isn't posibble in this case because of lot of data. Is it posibble to somehow save all of that informations to .json file in extension and retrieve it when user wants?

If you are looking for unlimited storage, you first need to add the "unlimitedStorage"-Permission to your manifest file.
Then you can choose one of the following storage options:
chrome.storage.local
IndexedDB
File System (chrome only)
App Cache
WebSQL (deprecated)
More Info
https://developer.chrome.com/extensions/storage
https://developer.chrome.com/apps/offline_storage
https://developer.chrome.com/extensions/manifest/storage
https://github.com/summera/chromestore.js

Related

How to force browser to download public asset from GCP Storage Bucket url?

I have assets from Wordpress being uploaded to GCP Storage bucket. But when I then list all these links to these assets within the website im working on, I would like the user to automatically download the file instead of viewing it in the browser when the user clicks on the link.
Is there an "easy" way to implement this behaviour?
The project is running with Wordpress as headless API, and Next.js frontend.
Thanks
You can change object metadata for your objects in Cloud Storage to force browsers to download files directly, instead of previewing them. You can do this through the available content-disposition property. Setting this property to attachment will allow you to directly download the content.
I quickly tested downloading public objects with and without this property and can confirm the behavior, downloads do happen directly. The documentation explains how to quickly change the metadata for existing objects in your bucket. While it is not directly mentioned, you can use wildcards to apply metadata changes to multiple objects at the same time. For example this command will apply the content-disposition property in all objects of the bucket:
gsutil setmeta -h "content-disposition:attachment" gs://BUCKET_NAME/**

Chrome extension API / Firefox addon API for accessing all site data

Is there an API to access all site data on all domains from a chrome extension (or firefox addin)?
Full story: I want to create a pseudo profile switcher, as an alternative to google's Google's "multiple sign-in". It will basically help user to switch between profiles that are created inside my extension. Right now, it is only a cookie-switcher because it can only access cookies (just like this extension: Swap My Cookies).
For creating a new profile (inside my extension) it saves all cookies in JSON format in filesystem and then deletes all cookies in browser, just like chrome's new profile. To switch between two profiles, it saves current cookies, clears cookies, and loads cookies for target profile. Note that I am not accessing chrome's actual profiles at all, and I am certainly not reading cookies from chrome's other profiles. This is just a pseudo profile switcher. Many websites are not working as they should work, because these websites store more things than just cookies. Is there a way to access all site data, and not just cookies? I have been working with chromium so far, but for this I am ready to switch to firefox or any other browser.
Following is picture of url chrome://settings/cookies after clearing all cookies using chrome extension API, how do I access the rest of data?
Image showing site data other than cookies
I want to create a pseudo profile switcher
For Firefox there is a per-tab container API under development which may pretty much provide what you want.

Is there any reliable way to capture file upload event in a chrome extension?

In my content script, I want to monitor which file a is getting uploaded to a web application.
I monitor "change" event for any "input:file" element. It works on any site (such as Gmail) that uses "input:file".
However sites like imgur, use SWFUpload mechanism. I tried to capture "fileQueued" event on element that I suspected to be swfupload. But that did not work.
How can I capture file upload event for sites that use swfupload?
Are there any other plugins that manage file uploading that I would need to take care in my content script?
Is there any generic mechanism to tackle this problem?
(I am aware of drag-n-drop mechanism, but I have not handled that case so far.
I have also read following relevant question on SO:
Grab file with chrome extension before upload)
It's probably worth your time to experiment with the chrome.webRequest API; it appears that the onBeforeRequest event contains info about file uploads. It's a complex API with extra parameters to addListener; read the docs thoroughly.

Can localStrage and/or indexedDb be used in a chrome extension to store data independently of the visited website?

In a Google Chrome extension, is it possible to use localStorage and indexedDb to store data independently of the visited website? And if so, is it possible to store it even after the browser has been closed?
For an example, the user would save a text in the extension when visiting www.site1.com, browse and/or close Google Chrome, then access its data again on www.site2.com.
Yes. It is possible. I am currently working on an extension which saves the data using indexed DB. You can store the data on the background page, i.e. background page should contain scripts to create, retrieve and delete the data. Data can be send to background page using content scripts.

Chrome extension: Memory data

I was wondering with Google Chrome's extension API, is it possible to extract memory usage data for each tab and use it in a popup? I know there is this extension https://chrome.google.com/extensions/detail/mmbijkbkjlefoimjopcojbkpnmljahlh but all it does is simply open the about:memory tab. I was thinking maybe there was a way to "parse" the about:memory tab and use it for my extension. Or am I delusional and this is not possible?
There is no such API and chrome:// scheme is forbidden for extensions so you can't parse that page either...
XMLHttpRequest calls to chrome:// are not allowed
Content scripts are not injected under chrome://
The chrome.processes API can be used to obtain the same data that the Task Manager uses: https://developer.chrome.com/extensions/processes

Resources