Where is chrome extension's 'chrome.storage.local' data saved? - google-chrome

I can find the previous localStorage api data in ~/.config/google-chrome/Default/Local Storage directory. I see that these are sqlite files which I can browse with sqlite3.
However, I'm moving from localStorage api to chrome.storage api and saving the information with chrome.storage.local method.
Now, how and where are these files are bing saved in my file system? I can't seem to find any information regarding this in their doc. Any help would be highly appreciated.

For Windows, you can find different data related to your extension [extension_id] at these places
C:\Users\[user_name]\AppData\Local\Google\Chrome\User Data\Default\Local Extension Settings\[extension_id]
C:\Users\[user_name]\AppData\Local\Google\Chrome\User Data\Default\Sync Extension Settings\[extension_id]
C:\Users\[user_name]\AppData\Local\Google\Chrome\User Data\Default\IndexedDB\chrome-extension_[extension_id]
want to checkout chrome.storage data
open developer tools pointing your background page
type command
chrome.storage.sync.get(null, function (data) { console.info(data) });
or
chrome.storage.local.get(null, function (data) { console.info(data) });

For Firefox which now use the same format as Chrome for addon they are saved here:
C:\Users\Marc\AppData\Roaming\Mozilla\Firefox\Profiles\x5jztslz.default\browser-extension-data\

Related

How to get auto complete suggestions on IDE while developing chrome extension using chrome api?

recently i am developing chrome extension. using js,html,css however for every action i am searching google for chrome.* api reference. is there any way to add extension for auto complete of chrome.* api methods in vscode?
If you use Vscode, just create or update jsconfig.json at the root of project :
{"typeAcquisition": {"include": ["chrome"]}}
Reference (User: ewwink): https://www.reddit.com/r/vscode/comments/93c2ez/chrome_extension_autocomplete/
Steps:
Visual Studio Code
File => Preferences => Settings
User
Extensions
Under Activation on Language => click on settings. JSON
Add the following inside the JSON
{"typeAcquisition": {"include": ["chrome"]}}
Voila you're ready !

How can I tell why my website uses LocalStorage and IndexedDb)?

When I visit my website using Google Chrome, Chrome shows (in "Cookies and Site Data") that it's using LocalStorage and IndexedDB. I'm not deliberately doing so, and I'd like to find out why those are appearing in the list.
The site does use a few 3rd-party things, notably (perhaps) Google Universal Analytics and Google Tag Manager, but I checked the JS source for both of those (including the file that gets downloaded on the fly), and could find no obvious references to LocalStorage or IndexedDB (though it's not exactly easy to read the minified code).
Is there any way to tell what's using those features?
FWIW it's an ASP.NET MVC5 website, though I doubt that's relevant.
If you don't have specific code doing this, then third party analytics/ads are the likely culprit. Here's what I'd try:
Use chrome://settings/cookies and delete the storage for your site
Identify a page in your site that causes the data to be written
Modify the page to have an inline script before any other scripts are loaded, that shims the storage APIs with dummy functions like:
window.indexedDB.open = function() {
throw Error('Indexed DB');
};
window.localStorage.setItem = function() {
throw Error('DOM Storage');
};
Reload the page with the developer console open. If you're lucky you'll see exceptions thrown with a stack trace pointing to the code that tried to use those functions.
If not, change those throw lines to simply debugger; to invoke the debugger, and reload the page again. The call stack in the debugger should show you what library is using the storage APIs.

Using appcache with php & database

I'm developing web apps using jQuery Mobile. These apps use a database to get prices, etc (using php).
I'm also using appcache to be able to use the apps offline.
<html manifest="manifest.appcache">
This is all working perfectly. But when I'm online, I don't want the apps to use the appcache.
How do I do that?
I can check wether I'm online/offline by checking if a file is available:
$.ajax({
url:'http://someurl.com/online.txt',
type:'HEAD',
error: function()
{
console.log('offline');
},
success: function()
{
console.log('online');
}
});
However I can't find anything to have the page not use the appcache..
Am I missing something?
Step by step solution:
Check if you're online/offline
If you're online, run a php script which adds a # at the end of the appcache manifest. This is because the cache will be updated if the manifest has changed.
Swap the cache and refresh the page
After i finally got it working i noticed it didn't work in Firefox because of the swapCache() function. (https://bugzilla.mozilla.org/show_bug.cgi?id=769171)
Lucky me my users don't use Firefox..

Is there a internal url for the File API - Directories and Filesystem on Chrome similar to chrome://appcache-interanals for appcache?

I have been playing with HTML5 Offline web apps and the File API using Chrome. After looking at what the guys and girls have done at html5rocks,
I was wondering if there is a way to find out more information about the file system/sandbox?
For example:
- Where on disk is the files/sandbox being stored?
- How much space is free/used?
- Is the data encrypted?
I am hoping for an internal Chrome url similar to chrome://appcache-internals which allows you to manage the appcache for an offline web app.
chrome://quota-internals is the file API (as well as a few other bits and pieces) analog to chrome://appcache-internals. In fact, since appcache is quota-managed in Chrome, I imagine that appcache-internals will go away at some point in the future, replaced entirely by a quota management page.
It appears to be broken in the current dev channel release, but it's working in tip-of-tree, so I'm sure it'll be available again soon. :)
Thanks the the book Using Html5 Filesystem API (by Eric Bidelman), if you go to "chrome://settings/cookies" search for your url you can find quota and usage stats about the local filesystem.
The following code snippet also prints out this info:
window.webkitStorageInfo.queryUsageAndQuota(TEMPORARY, function(usage, quota) {
console.log('Using: ' + (usage / quota) * 100 + '% of temporary storage');},
function(e) {
console.log('Error', e);
});

How to download a CRX file from the Chrome web store for a given ID? [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 months ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'd like to download the .crx file of an extension from webstore, I use fiddler to analyze the network request when I install an extension from webstore and got it.
For example, for the extension: https://chrome.google.com/webstore/detail/bjclhonkhgkidmlkghlkiffhoikhaajg
the download link is:
https://clients2.googleusercontent.com/crx/download/OgAAADQ_Loe5gfVPF2OUaB35tvex-NKlmA8V4K5YlWuvLCknMH7egLLmnMoFuCZePl_idE1GMf8jZC2KbjQqyyLDoDAAxlKa5eDp-z9frOppHWtQsRU3-iGrrrrA/extension_1_7_11.crx
Now I'm wondering if there is a universal method for get .crx of an extension, the problem is how did Google encryption
bjclhonkhgkidmlkghlkiffhoikhaajg
into
OgAAADQ_Loe5gfVPF2OUaB35tvex-NKlmA8V4K5YlWuvLCknMH7egLLmnMoFuCZePl_idE1GMf8jZC2KbjQqyyLDoDAAxlKa5eDp-z9frOppHWtQsRU3-iGrrrrA ?
any idea will be helpful.
The CRX file itself can be directly downloaded from
https://clients2.google.com/service/update2/crx?response=redirect&prodversion=[PRODVERSION]&acceptformat=crx2,crx3&x=id%3D[EXTENSIONID]%26uc
[PRODVERSION] is the version of Chrome, which must be 31.0.1609.0 at the very least, and
[EXTENSIONID] is the ID of the extension
(New in 2018) acceptformat=crx2,crx3 instructs the server to also respond with extensions in the CRX3 format (instead of 204 No Content when the extension is not available as CRX2).
If the extension you're using contains OS-specific modules (e.g. NaCl), then you have to add additional parameters (os, arch, nacl_arch).
For the full logic of generating a complete CRX download URL, see the get_crx_url function in https://github.com/Rob--W/crxviewer/blob/master/src/cws_pattern.js.
This is a part of the Chrome Extension Source Viewer extension, available in the Chrome Web Store: https://chrome.google.com/webstore/detail/chrome-extension-source-v/jifpbeccnghkjeaalbbjmodiffmgedin
Note that opening the previous URL in Chrome will not trigger a download because Chrome automatically intercepts responses whose Content-Type is set to application/x-chrome-extension. If you want to programatically download the crx file in a Chrome extension, change the MIME-type to application/octet-stream (e.g. as done in src/lib/crx-to-zip.js).
For one of my extensions I had to download other CRXs automatically knowing only extension ID. I solved this by opening the following URL:
http://clients2.google.com/service/update2/crx?response=redirect&x=id%3D<EXTENSION_ID_HERE>%26uc%26lang%3Den-US&prod=chrome
this page will forward you to that https://clients2.googleusercontent.com/crx/download/ address.
I don't remember already how I came up with that URL (it was either in page source somewhere or I used network sniffer), but it has been working great for me since last December, so it looks reliable.
I wrote a small python script to automate that process what #serg #Rob W
https://gist.github.com/arulrajnet/2424bc1ffc40324f3786
you can use that also.
python ChromeAppDownloader.py -u https://chrome.google.com/webstore/detail/google-maps/lneaknkopdijkpnocmklfnjbeapigfbh
This is how you have to use.
You can use the below URL template,
https://clients2.google.com/service/update2/crx?response=redirect&prodversion=[PRODVERSION]&x=id%3D[EXTENSIONID]%26uc
The PRODVERSION is the Chrome version. (get it from settings -> Help -> About Google Chrome).
Ex : Version 69.0.3497.100 (Official Build) (64-bit)
The EXTENSIONID is the id for the extension.
Ex : Here is a sample plugin, https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji?hl=en the id is hmhgeddbohgjknpmjagkdomcpobmllji
So sample request to download will be https://clients2.google.com/service/update2/crx?response=redirect&prodversion=69.0.3497.100&x=id%3Dhmhgeddbohgjknpmjagkdomcpobmllji%26uc
Another way to get the crx file.
Copy the url of the extension, for example:
https://chrome.google.com/webstore/detail/tiff-viewer/fciggfkkblggmebjbekbebbcffeacknj?hl=es
In the website http://crxextractor.com/
Click in the option "START FOR FREE".
Paste the url of the extension in the textbox.
Click in the option "DOWNLOAD".
Click in the option "GET .CRX".
This is a lower-tech way of doing it than to use fiddler, and I realize this is three years old now, but I always look to see if someone else has solved the problem. So I found someone did, and I just used their solution several times successfully. Their solution is an extension that can download other extensions, called Give Me CRX:
https://chrome.google.com/webstore/detail/give-me-crx/acpimoebmfjpfnbhjgdgiacjfebmmmci
To download the chrome extension from a given id, you could just use like this
var currentEXTId = 'bjclhonkhgkidmlkghlkiffhoikhaajg';
let downloadURL = https://clients2.google.com/service/update2/crx?response=redirect&x=id%3D" + currentEXTId + "%26uc&prodversion=32;
The above one is the download URL for the chrome extension.
There is also a chrome extension which could help you for downloading chrome extension as zip or crx file.https://chrome.google.com/webstore/detail/crx-extractordownloader/ajkhmmldknmfjnmeedkbkkojgobmljda
Also the code for how its done is available in this Github repo
Create a bookmark add the javascript function as the address.
Browse to the chrome extension you want to download then click on the bookmark and it should start downloading.
javascript:(function(){
var pathname = location.pathname;pathArray = pathname.split("/");
location = ("http://clients2.google.com/service/update2/crx?response=redirect&x=id"+"%" + "3D" + pathArray[pathArray.length -1]+"%" + "26uc%" + "26lang%" + "3Den-US&prod=chrome"); })();
Thanks
Also, I recommend to try this website http://crxextractor.com.
Here you can download an extension by it's Chrome Webstore URL and extract it's source code in the browser, no additional software required, and everything get done in a click or two.
I made a simple Python script for downloading extensions as CRX files from the Chrome Web Store:
It has no external dependencies and works with either Python 2 or 3.
Thanks to Rob W for the original solution.
None of the manually ways in this post works for me so i searched for a URL to download the extension direct.
Find this and works perfect for me.
https://clients2.google.com/service/update2/crx?response=redirect&prodversion=49.0&x=id%3D###EXTENSION_ID###%26installsource%3Dondemand%26uc
You must replace ###EXTENSION_ID### with the extension id from the chrome shop.
Its part of the URL.
Example Google Translate Extension:
https://clients2.google.com/service/update2/crx?response=redirect&prodversion=49.0&x=id%3Daapbdbdomjkkjkaonfhkkikfgjllcleb%26installsource%3Dondemand%26uc
This works for Microsoft Edge Chromium:
https://edge.microsoft.com/extensionwebstorebase/v1/crx?response=redirect&prod=chromiumcrx&prodchannel=&x=id%3D<EXTENSION_ID_HERE>%26installsource%3Dondemand%26ucĀ 
You use the https://www.crx4chrome.com/ and search for your extension, it also has a different version of that extension, once you click it download .crx file