How to set a cookie file from the command line? - google-chrome

I use the following Firefox extension to get cookies in Netscape HTTP Cookie File format.
I want to load the cookie in chrome browser from the command line by starting a new browser process. But I don't find an option to set a cookie input file.
https://peter.sh/experiments/chromium-command-line-switches/
If this is possible, how can I do it?

Related

how can i import Cookie file in Chrome98?

In the old version, i can replace the Cookies file under
AppData\Local\Google\Chrome\User Data\Default to another computer
and i can use cookie from the file. But when I try this on chrome 98.
I can't migrate the cookie data. And I found that the Cookies file was put under the network folder.

Problem with content encoding and connecting with DevTools to chrome headless

I am starting a headless chrome instance like that, e.g.
/opt/google/chrome/chrome --headless --disable-gpu --remote-debugging-port=9222 https://www.chromestatus
and want to connect with DevTools to this instance by entering localhost:9222 into a running browser. However, what I see is just some garbled stuff like this here "��TQo�0~ϯ���$���li51����manri̜8�������m::�...", probably because the server process at localhost:9222 sends the response gzipped, but does not include a content-encoding in the response headers (at least, that's my theory why this happens...)
Any idea how I can fix this? I haven't found any option to control this behavior (e.g. to tell the headless chrome instance to not zip the response data...)
BTW: I see the same whether I enter the url in chrome, chromium or firefox or use wget, and also whether I use chrome (Google Chrome 84.0.4147.105) or chromium doesn't make a difference...

Blocked current origin from receiving cross-site document at 'myRemoteSite' with MIME type application/json

I think happened in the latest update of Chrome. They're not letting any of these content types if they come from a site. This is problematic because I need the chrome developer tools to develop my app making calls to an api. Does anyone know how to disable or override this?
Change the directory in cmd to "cd Program Files (x86)\Google\Chrome\Application"
and execute the below command to disable chrome security and also avoid "Blocked receiving cross-site document warning."
C:\Program Files (x86)\Google\Chrome\Application>chrome.exe --user-data-dir="C:/Chrome dev session" --disable-web-security --user-data-dir --disable-features=CrossSiteDocumentBlockingIfIsolating

How could I save files on browser cache after pushing it with a Server push?

I have an Apache with http2, and I have made a server push of files which I would like to save on browser cache, but it doesnt and I dont know why.
I have made the push with a php file, the following one.
header( 'Link: <'https://www.myweb.com/mypath'>;rel="preload";as="video"', FALSE );
From my point of view, the Server push is working, because I can see the requests to the server in the access_log, but I think that the files should be saved on the browser cache, but It doesnt.
I try to make a server push of a file, and after it, request this file and get it from cache (see on the Network console of Chrome "from cache").
Thanks
All you said was true, and I had it on my code, but the trouble was on the understanding of the Google Chrome Cache saving.
When you send some file with Server Push on an HTTP2 connection, the file requested via server push is sent as response to the client, but Google Chrome does not save it into Google Chrome cache until the file was requested by the browser.
For example: The server sends the response of index.html with its stylesheet.css (this one sent with server push). The stylesheet will only be saved into Google Chrome cache when Google Chrome request the Stylesheet.css(the client has requested only the index html and make a push of the stylesheet). If Google Chrome does not request it, it will be an unclaimed push and it will not be saved into cache.
If you have a success push, and reload the page, you will see "from cache" on Google Chrome.
Thanks for your time.

Google Translate TTS problem

I'm testing with a simple HTML file, which contains:
<audio src="http://translate.google.com/translate_tts?tl=en&q=A+simple_text+to+voice+demonstration." controls autoplay>
with Chrome v11.0.696.68 and FF v4.0.1. I'm going through a proxy server and it doesn't work. Nothing gets played and clicking on the play button doesn't work in Chrome. In FF it flashes and then shows an 'X' over the control. The error logs don't show anything.
So I've broken down the steps:
Typing the URL into either browser works
wget -q -U Mozilla -O /tmp/tts.mp3 "http://translate.google.com/translate_tts?tl=en&q=Welcome+to+our+fantastic+text+to+voice+demonstration." gets me a file that plays fine on both browsers.
If I serve this file from my local web server it works fine (i.e. one that doesn't go through the proxy). i.e. src="http://localhost/tts.mp3"
I'm stumped. If the proxy were the problem then wget and address bar access shouldn't work. If the src being a URL were the problem then it shouldn't work from my local server.
Any clues? suggestions?
The reason this isn't working is most likely because translate.google.com restricts certain types of requests to prevent the service from being overloaded. For instance, if you use wget without the "-U Mozilla" user agent option you will get an HTTP 404 because the service restricts responses from wget's default user agent string.
In your case, it looks like what is going on is that translate.google.com is returning a HTTP 404 if a HTTP Referrer is included in the request. When you run wget from command line there is no referrer. When you use the audio tag from within a webpage, an HTTP Referrer is provided when requesting the translation. I just tried the following and got a 404.
wget --referer="http://foo.com" -U Mozilla -O /tmp/tts.mp3 "http://translate.google.com/translate_tts?tl=en&q=Welcome+to+our+fantastic+text+to+voice+demonstration
However if you take the --referer option out, it works.
The service is working here (11-NOV-2011) but is limited to 100 characters. You can split your text into 100 char chunks, download the mp3 result for each chunk and then join the chunks for the final Mp3 file.