how to write chrome extension logs to file - google-chrome

Hi I'm working with the chrome extension and I would like to save the console.log items to file so that I could retain the logs and review it. Is there any way to save log in chrome extension.
Found chrome.filesystem but it cant be used in chrome extension. read that chrom.filesystem is using in chrome ap to save the log. also cant use the fs package like we are using in the javascript program.

Related

Chrome allow automatic download

I have a HTML file with javascript which runs locally on my pc. (Not using server!)
When the program runs in error, it creates a log TXT. I am using 'console.save' script.
My problem is that chrome doesn't automatically downloads the second txt, because it asks for permission to download. If I give permission it works but only until I refres the page. After refresh it won't work.
I tried in "chrome://settings/content/automaticDownloads" to give permission but it does not work. It's not an URL, it's a "file:///C:/index.html".
In the settings I have only 2 options. To deny the download or to ask for permission. There is no option to allow all downloads.
Is there any way to allow it?
In Chrome, go to this url:
chrome://version/
There you can see the Profile path. Go to that location. By default it is:
C:\Users\YOURUSERNAME\AppData\Local\Google\Chrome\User Data\Default
Here, find the Prefrences file. Before editing, close Chrome. Then edit the prefrences file with any text editor and add this:
"default_content_setting_values":{"automatic_downloads":1}
Now Chrome will not ask for permission when it want's to automatically download files.

How to Export Google Search History

Looks like Google has stopped supporting "Download Searches" button as mentioned here: https://support.google.com/websearch/answer/6068625?hl=en . One option is to get history from Google Chrome using something like this https://gist.github.com/evidanary/d02d89c632530878163f256fe993d5a4 . But the history in Chrome is not complete and only goes back for a few months(guessing thats when I upgraded OS).
Does anyone know how to export the search history from beginning of time?
Steps for any OS:
Type about:version in the Chrome address bar and press Enter (also works for Chromium, Iridium, Brave, etc).
Copy the path listed under Profile Path and close Chrome.
Navigate to the profile folder and locate the file named History.
The file is in the SQLite3 format and can be opened with any of the available GUIs, for example DB Browser for SQLite which is cross-platform, open-source and actively maintained.
From the SQLite tables select the urls table to see all visited URLs. You can also use File > Export to get them as a CSV (Excel), JSON or SQL file.
If you are using multiple Chrome profiles then repeat 1-5 for each profile.
I stumbled upon this when I had to migrate data from one machine to another.
Google searches in chrome are saved along with chrome history. I migrated the complete chrome history and could get the autocomplete results for my past searches.
The search history for chrome is saved in the location
(~UserProfile)\AppData\Local\Google\Chrome\User Data\Default
Look for a file History inside this folder. This is the complete chrome history (or from the time you last cleared chrome history).

How to write a blob to a file in Chrome apps?

I am developing a chrome app which can download videos from server, save it locally and display it when user wants to. I am able to get the blob using xhr from server, but I do not know how to write it to a file, I am using Chrome.file system api. No luck. Any links to tutorials on using file write api ?
Take a look fileSystem API
Chrome Dev Editor uses it.

how to run batch file in chrome

I tried using very simple HTML to create several links to several batch files on my server that are intended to run when users click on the links. Using Chrome, every time I click on one of those files my browser displays the script itself (even though its a .bat) and doesn't actually run the script. Internet Explorer runs it every time, however all the users on the network use Chrome for web browsing.
Is there any way to force Chrome (preferably through HTML or VB or some other scripting on the page itself rather than change all of the users' browser settings) to run these batch files when the user clicks on the link?
The answers given so far - that it's "not possible" - are incorrect or outdated. Using Chrome Apps you can call executables (called "hosts") if they are registered with Chrome. Of course a Chrome App is a client application so you need to distribute it.
See https://developer.chrome.com/extensions/nativeMessaging#examples
HTML, JS on browser cannot run shell command, command line. You have to implement server script to execute your bat file then call it from HTML, JS via Ajax or direct link.

Disable update of specific chrome extension

With recent news of adblock being sold to some unknown company, first thing i want to do is disable any possible update for that extension.
I've found number of questions but they are outdated. So chrome pros please tell how do we disable a specific plugin? and please take into consideration that there are many instances which synchronize it is important that the change gets synchronized to other computers, if it is not how do we do that?.
And a secondary question : where do we find sources of already installed extension? so that we could later pack and run it?
Chrome does not offer a way of disabling an update for a specific extension.
If you want to make sure that you run some specific version of an extension, you could try any of the following options:
Read-only extension folder
Go to the directory containing the extension, and mark the directory as read-only. To find that directory, visit chrome://version and look at the path at "Profile Path". The extension will then be at [value of Profile path]/Extensions/[32-character extension id].
Download the source code
Download the source code of the extension, and load it as an unpacked extension (or upload it to the Chrome Web store, and then install it).
There are several ways to get the source code (including just copying it from the directory as I mentioned at the previous step).
If you want to download a Chrome extension without installing it (e.g. because the new version contains unwanted "features" that you want to remove), then you could use my Chrome extension source viewer to download the code.
Some extensions expect to be run with a specific extension ID. You can forge this extension ID if you load the extension in unpacked mode (but you cannot upload the extension to the CWS if you do that). For instructions on fixing the extension ID, see How to change chrome packaged app id Or Why do we need key field in the manifest.json?.