-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome
525 lines (441 loc) · 25.2 KB
/
chrome
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
Linux chrome shortcuts: https://support.google.com/chrome/answer/171571?hl=en
==============================================
Questions about chrome:
Q: what's that chrome request debugger?
PA: well there's an extension called HTTP Trace: https://chrome.google.com/webstore/detail/http-trace/idladlllljmbcnfninpljlkaoklggknp/related?hl=en-US
And mine works pretty well: webRequestExample
https://github.com/donhatch/chromeWebRequestExample
Currently have to edit source to change params though.
Q: close a tab?
A: ctrl-w (linux), cmd-w (mac)
Q: close a window?
A: ctrl-shift-w (linux), cmd-shift-w (mac)
Q: find/find-next?
A: ctrl-f/ctrl-g (linux), cmd-f/cmd-g (mac)
Q: dup current page in new tab?
A: right click on tab -> duplicate, or:
linux: alt-d (to focus address bar), alt-enter (to open it in a new tab)
mac: cmd-l cmd-enter (background) or cmd-l cmd-shift-enter (foreground)
Q: next tab?
A: ctrl-tab
Q: prev tab?
A: ctrl-shift-tab
Q: reopen last tab I've closed?
A: ctrl-shift-t (remembers last 10)
Q: exit? (on linux there's an exit menu item, or shift-ctrl-q, but what about mac?)
PA:
apparently there's no way to graceful exit, even in the chrome Task Manager window.
close all windows then Apple->Force Quit. what the fuck???
A: oh! command-q does it! not available in any menu???
Q: but I really want it to ask for confirmation. how?
there's lots of web conversation on this... apparently the feature appeared then disappeared lots of times?
my chrome on the mac is version 30.0.1599.101
Q: I can't log in to stackoverflow--
my usual way is to do it through my google login
but it's using [email protected] -- I guess somehow I'm "logged in" to that
in some sense and I don't know how to log it out??
A: get into gmail and sign out there (click on drop-down that shows my name)
Q: in the Developer Tools -> Network -> Filter,
how do you control it??
- most of the time it won't let me type into it
(maybe move the mouse out and then back in the window?)
- how do I select everything with "lyrs" or "mapslt" in it?
Q: when I execute google-chrome (or google-chrome-beta) from command line,
it always says "Created new window in existing browser session.",
but sometimes it actually creates a new window and sometimes
just a new tab.
sometimes I want a new window; sometimes I want a new tab.
Is there any way to control which of the two things happens?
PA: looks like if there's a ":" in the url it opens a new window!?
so don't to that.
Q: how to open something from command line, to an *existing* window/tab?
(e.g. I regenerated a file and I want to make it refresh, from command line)
PA: seems like it's not supported.
Relevant links:
https://askubuntu.com/questions/150705/open-url-in-chromium-and-switching-to-existing-tab-open-if-url-already-open
https://stackoverflow.com/questions/5588658/auto-reload-browser-when-i-save-changes-to-html-file-in-chrome/29466420
https://bugs.chromium.org/p/chromium/issues/detail?id=661125
https://chrome.google.com/webstore/detail/refresh-monkey/ljngnafhejmefmijjoedbclkadhacebd?hl=en
https://sakthipriyan.com/2016/02/15/auto-refresh-chrome-when-files-modified.html
Q: what's a decent workaround? an extension to help? a wrapper page
to auto refresh the page on file change? Or just every 5 seconds or so?
PA: ooh someone has a hack that might work!
http://razius.com/articles/auto-refreshing-google-chrome-on-file-changes/
Bleah, can't seem to get xdotool to send keystrokes to chrome windows for some reason?
Oh! Just need to run "xdotool windowactivate 0x5c0002d" before the other.
Still, pretty fragile.
PA: I'm trying the "Super Auto Refresh Plus" extension.
Ooh it's nice, it has a countdown timer in the extension icon! Cool!
Things I don't like:
- It keeps updating even when the tab isn't visible
Verified by putting this inside the html:
<script> console.log("LOADING! "+new Date().toString()); </script>
- timing isn't right. I'd like it to do the following, solidly:
3<1sec>2<1sec>1<1sec>bam! blank for a moment while it refreshes, then come back with 3<1sec>2<1sec> etc.
Instead, it updates flakily, sometimes showing the 3 and sometimes not, sometimes showing 0 and sometimes not, sometimes showing the final 1 for half a second and then disappearing.
Let's see, can I do a poor man's version of this?
I can do this from the console once:
(()=>{
console.log("5...");
document.title = "5...";
setTimeout(()=>{
console.log("4...");
document.title = "4...";
setTimeout(()=>{
console.log("3...");
document.title = "3...";
setTimeout(()=>{
console.log("2...");
document.title = "2...";
setTimeout(()=>{
console.log("1...");
document.title = "1...";
setTimeout(()=>{
console.log("RELOADING!");
document.title = "0!!!!!";
window.location.reload(true);
console.log("RELOADED!");
setTimeout(()=>{
console.log("haHA!"); // this never comes out
document.title = "haHA!"; // this never comes out
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
}, 1000);
})();
Or, put it in a <script> in the file and it gets repeated. Cool.
So then can I set some extension title to it?
It *does* have somewhat flaky timing, though... the console messages are responsive, the tab title change
lags behind by a quarter second or so.
Interesting to note: if I switch to another tab, that one's countdowns slow down to about half speed!
Rewriting using a promise:
(()=>{
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
console.log("5...");
document.title = "5...";
delay(1000).then(()=>{
console.log("4...");
document.title = "4...";
return delay(1000);
}).then(()=>{
console.log("3...");
document.title = "3...";
return delay(1000);
}).then(()=>{
console.log("2...");
document.title = "2...";
return delay(1000);
}).then(()=>{
console.log("1...");
document.title = "1...";
return delay(1000);
}).then(()=>{
console.log("RELOADING!");
document.title = "0!!!!!";
window.location.reload(true);
console.log("RELOADED!");
return delay(1000);
}).then(()=>{
console.log("haHA!"); // this never comes out
document.title = "haHA!"; // this never comes out
});
})();
Q: vim hotkey to open cs to the right place?
maybe *?
possible resources which aren't panning out yet:
https://sites.google.com/a/google.com/codesearch/Home/users-manual?pli=1#TOC-...-vim
https://sites.google.com/a/google.com/codesearch/faq
Let's see, the search would be something like:
google-chrome-beta "https://cs/#search/&q=file:geo/vectordb/util/geometry/bottom_up_geometry_tiler.cc"
or just the following which gets converted to it:
google-chrome-beta "https://cs/?q=file:geo/vectordb/util/geometry/bottom_up_geometry_tiler.cc"
oh bleah! but if I add &l=123, it gets lost in translation...
bleah!
oh wait, this works:
google-chrome-beta "https://cs/#search&q=geo/vectordb/util/geometry/bottom_up_geometry_tiler.cc:123"
as does this:
google-chrome-beta "https://cs/?q=geo/vectordb/util/geometry/bottom_up_geometry_tiler.cc:123"
so here's a decent map (the "silent" and <C-l> avoid the "Press ENTER or type command to continue":
:map * :silent !google-chrome-beta "https://cs/?q=geo/vectordb/util/geometry/bottom_up_geometry_tiler.cc:123" \| grep -v "Created new window in existing browser session." &<CR><C-l>
and to get the real file and line number in there:
:map * :exe 'silent !google-chrome-beta "https://cs/?q=%:'.line(".").'" \| grep -v "Created new window in existing browser session." &'<CR><C-l>
(special chars in the file name could theoretically mess things up, but this seems unlikely to happen)
Q: argh! if I've inserted stuff so that line number is > original file size, the search fails! in that case I'd like it to just go to the end, I think
Q: how to restart chrome, recreating all tabs and windows?
A: chrome://restart
Q: can I change my "drag" cursor? the default one really sucks,
it doesn't give me a feeling for where the pointer point is,
and actually obscures it.
===================================================================
exploring redirects
When I type http://google.com into my browser and hit Enter:
The Developer Tools console Network tab shows this:
http://google.com/ returned 301 Moved Permanently, to...
http://www.google.com/ returned 302 Found (aka Moved Temporarily) to...
https://www.google.com/ returned 200 ok
The Redirect Path extension concurs.
History shows:
https://www.google.com/ DAMN!
I was hoping... oh! Looks like there's another one: 307,
which maybe puts original Request-URI in the history?
10.3.8 307 Temporary Redirect
The requested resource resides temporarily under a different URI. Since the redirection MAY be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache-Control or Expires header field.
The temporary URI SHOULD be given by the Location field in the response. Unless the request method was HEAD, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s) , since many pre-HTTP/1.1 user agents do not understand the 307 status. Therefore, the note SHOULD contain the information necessary for a user to repeat the original request on the new URI.
If the 307 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
All right how do I test this???
Need to set up a server
that does a 307 redirect...
Oh, this page has it already:
http://jigsaw.w3.org/HTTP/300/Overview.html
Damn! it doesn't work!
======================================================================
Okay, strategy for trying to get original URL in:
- global history
- page reload history (or maybe cascading menu, so each entry knows its redirect chain? that would be great)
- back button history
- the url bar itself (or maybe right-click menu with option to get any of the redirect chain? that would be great)
when a redirect happens:
if the page that initiated the redirect was not itself initiated by a redirect
put the initiating page in the history.
example:
http://go/who 302 Found (initiator: Other)
https://goto.google.com/who 302 Found (initiator: http://go/who Redirect)
http://googlewho.appspot.com/ 302 Found (initiator: https://goto.google.com/who Redirect)
https://googlewho.appspot.com/ 302 Found (initiator: http://googlewho.appspot.com/ Redirect)
https://teams/googleplex.com/ 200 OK (initiator: https://googlewho.appspot.com/ Redirect)
in this case we'd want to add http://go/who to the history (back button?) so it doesn't get lost.
another example:
http://bns/ih/borg/ih/bns/cartewheel-eng/dev-donhatch.processing_servers.workertaskservers/0/statusz 302
https://bns/ih/borg/ih/bns/cartewheel-eng/dev-donhatch.processing_servers.workertaskservers/0/statusz 302
http://ihbne9.prod.google.com:25362/statusz 200
another example:
http://0.dev-donhatch.processing_servers.workertaskservers.cartewheel-eng.ih.borg.google.com/statusz 302
http://0.dev-donhatch.processing_servers.workertaskservers.cartewheel-eng.ih.borg.google.com:25362/statusz 200
And... strategy for tracing redirects that are happening
during cartewheel?
Hmm, it says initiator was Other,
and does not look like it's coming from a redirect. Where the hell is it coming from???
And strategy for more intelligent redirecting if possible?
Also to look into: "meta refresh", which apparently does a redirect without clobbering back button history (but it has an annoying delay)
Older material (should merge with the above at some point)
=============================================================================
http://reviews.cnet.co.uk/software-and-web-apps/50-essential-chrome-tips-50008273/
Very cool things:
ctrl-shift-I: developer tools
ctrl-shift-J: javascript console (just developer tools opened to that tab)
Q: can I customize some styles? (link colors and stuff)
A: on windows vista:
~/AppData/Local/Google/Chrome/User\ Data/Default/User\ StyleSheets/Custom.css
for example:
A:link { color: #80a0ff ! important }
A:hover { color: #ffff00 ! important }
A:visited { color: #a000ff ! important }
when the file is changed, displayed pages change instantly.
Q: is there a keyboard shortcut to open the link in a new tab?
various sites say ctrl-shift-left but it doesn't work.
Q: how do I change the font size when printing?
it prints teeny tiny and I want to make it bigger.
Q: can I set up some custom thing
in which tabs are arranged in a tree view,
with pages arranged under where they started from,
and I can move them around and delete subtrees etc.?
that would be kind of cool
Q: how do I tell which tab is using cpu?
A: Tools -> Task Manager
Q: how do I tell which tab is using memory?
PA: (still not sure exactly how to use it usually)
chrome://memory
https://developers.google.com/chrome-developer-tools/docs/heap-profiling
Q: how do I disable the Predictions url drop-down?
I would like to set it so there's no drop-down ever.
PA: menu -> settings -> Show advanced settings...
-> Privacy -> "use a prediction service"
uncheck it.
woops, does not work.
I don't think there's a way?
even though it takes up
half the screen on android??
I don't think it can be done :-(
See this if serious: http://blog.techprognosis.com/2011/07/08/privacy-how-to-lock-down-googles-chrome-browser.html
Q: how do I get chrome to forget links I've visited?
the following doesn't do it:
History -> Clear browsing data... -> obliterate everything
A: oh hmm, actually I think it's completing
based on bookmarks. I'd have to remove the bookmarks too.
Q: what tab managers do I like?
A:
- Tab Outliner seems to be the most useful/intelligent, from what I've seen.
Tips:
- from https://www.youtube.com/watch?v=VvlK1ttZ3dI "How to easily clean-up you browsing tree in Tabs Outliner":
- use clone view to have 2 views, allows dragging between distant locations
- instead of deleting, move things to a garbage pile; that's easier to retrieve something if put there accidenally.
Bugs:
- the fact that it says '?' gives help
but then when you type ? it says "that's only available in paid mode"
feels like a bit of an insult, like bait-and-switch.
- it jumps when I shift focus to a different chrome window,
even if whole tree fits on screen. should never jump if whole tree
fits on screen! and I need it to avoid jumping wherever
possible in general.
Questions:
Q: can I make it pop a window to the front?
- Hey wait a minute-- is there something called "Tree Tabs"? https://www.youtube.com/watch?v=Q9AKiqhtMRQ
Is it called "Sidewise Tree Style Tabs"?
Hmm, installed that, it seems to be a bit flaky,
but maybe just because it's fighting with Tab Outliner. Disabled it.
EXTENSIONS:
Q: how do I customize the icon menu?
PA: maybe this is relevant: https://stackoverflow.com/questions/19468429/add-contextmenu-items-to-a-chrome-extensions-browser-action-button
Q: what's the quickest way to reload an extension after modifying source code?
PA: hit ctrl-R in its background page, that will reload the background page, but not the manifest.
To get the manifest, I think you need to do "Load unpacked" in the "Manage Extensions" (which means "Manage this extension") page?
Q: how do I make a user script?
A: make a chrome extension
Q: What are the differences among user scripts, content scripts, background scripts, injected scripts?
PA: see this answer, which covers extension code (background page, content scripts, injected scripts):
http://stackoverflow.com/questions/9915311/chrome-extension-code-vs-content-scripts-vs-injected-scripts#answer-9916089
However, it doesn't cover user scripts.
Q: on redirect, the url in the url bar gets rewritten
and there's no way to get back to the original robust url.
Any way to make life easier?
(see other stuff about history in this doc, too. have not got anyhthing working yet though, chrome.history.addUrl seems to be non-functional :-()
PA:
read and understand this flow chart:
https://developer.chrome.com/extensions/webRequest
http://www.adambarth.com/experimental/crx/docs/webRequest.html
and this maybe, although it's the opposite of what I want,
when I understand it all maybe I will be able to answer the question
https://chrome.google.com/webstore/detail/switcheroo-redirector/cnmciclhnghalnpfhhleggldniplelbg
(installed it, it's good for some other things)
Also some web pages rewrite the URL too, e.g. google maps... think about whether to fight or cooperate with that.
Q: why are my extensions hidden behind a menu? I want Clear Cache or Cache Killer to be an always-visible button.
A: OH! drag the lhs of the address bar to the left, they will appear!!
(someone was complaining they don't stick if you exit chrome and start again, but they seem to)
Q: can I put the extension browser-action icons on a row below the address bar?
there are too many of them and it's making the address bar too small :-(
Q: I selected "Hide in chrome menu" for an extension. How do I un-hide it?
A: it got moved to the top of the vertical ellipses icon menu over on the very right side. Just drag it back.
Ideas for extensions:
- on redirect, put original url in history (instead of, or in addition to, the new one)?
- maybe, use chrome.webRequest (or beta chrome.declarativeWebRequest?) to intercept every request,
and put it in history immediately before it turns into a redirect?
(check out Redirector, maybe does what I want? has regexes etc.)
(OH NO it's gone???
(installed "Redirect path" which is a good viewer for exactly what the redirect path is...
it can be long! e.g. go/who)
(see other extensive thoughts on this elsewhere in this doc)
- substitute patterns, like switcheroo does, using chrome.webRequest api, but,
- less unusable ui (maybe no ui, just file configuration and a reload button?)
- regexes, duh (Regex Search)
- restrict context, e.g. only do it on urls generated by a page whose url matches some other regex
- very quick "clear cache" button
see chrome://cache or about://cache (same thing I think)
there are some existing extensions:
Clear Cache (I think this might be it... pretty configurable)
Click&Clean (nice but takes some extra clicks)
Cache Killer (try this one too... when enabled, automatically clears cache before loading a page)
But what I really want is the ability to have custom buttons
that do various custom combinations of things,
so that I don't have to get derailed by changing settings
and then forgetting to change them back.
- everything
- cookies only
- caches only
- cookies and caches only
maybe times various times too? hmm
See here:
http://www.bigspaceship.com/chrome-extensions-are-good-for-you/
https://developer.chrome.com/extensions/getstarted
Q: where do extensions live?
A:
linux: ~/.config/google-chrome-beta/Default/Extensions
or: ~/.config/google-chrome-beta/Profile 1/Extensions/eogalmedmljabbaahganginmeabadfbp
mac: ~/Library/Application\ Support/Google/Chrome/Default/Extensions
Q: what about settings?
Q: What do I have to clear to get it to not autosuggest
links I've visited?
A: History -> Clear browsing data... -> Browsing history (and maybe download history).
Or, in "Clear Cache" extension, check "History".
Note however that the autosuggest drop-down
also looks at bookmarks! So if you really don't want any dropdowns,
you'd have to remove all your bookmarks.
Q: I know an extension can't have multiple icons.
But I'd like two readily accessible buttons:
1. "Clear App Cache and Cache"
2. "Clear App Cache, Cache, and Cookies".
Having to switch the Clear Cache options back and forth just sucks!
A:
Strategy 1: Make 1 or more copies of the Clear Cache extension,
with separate icon and options for each.
[is the source available?]
[can just copy the dir, change the version, and reload it?]
[bleah! how to make it appear separately?]
[too hard :-( ]
Strategy 2: Make two very simple special purpose extensions,
with distinguishable icons, that do exactly the two actions I want.
Maybe:
Clear Cache icon with an exclamation point
Clear Cache icon with two exclamation points
[The "Delete All Cookies From Javascript" extension might
be a good reference.]
Strategy 3: Enhance Clear Cache extension to support configurable
entries in the right-click menu.
The options page should allow editing them:
- rename an entry
- clone an entry
- add an entry (or maybe just clone?)
- delete an entry (unless it's the default one)
- swap order of two entries (or move entry left/right earlier/later)
- show/hide entry in menu
- different keyboard shortcuts for different entries
[Yow! Way too ambitious.]
Q: pixels as little squares?
A: Use extension Stylish:
make rule "Pixelated images and canvases",
applies to: Everything
img, canvas {
image-rendering: pixelated;
}
(Unfortunately doesn't seem to apply to file:// images,
but can add it to the img's Styles in the dev console, temporarily.)
(To really view an image file, make an html page with an img tag
that refers to it)
And use that CSS fragment in all web pages I care about.
ARGH! Blocked by administrator! DamnDamnDamn
(oh, there was a malware excalation)
(how about stylist? hmm doesn't exist any more, damndamndamn)
Q: is there a good workflow for pinning tabs? e.g. mail, calendar...
PA: https://www.howtogeek.com/howto/7264/make-google-chrome-open-with-pinned-tabs/
hmm, have to manually open and pin, in each new window... I think? not sure.
Hmm and there's supposedly Basics -> On tartup -> Open the following pages -> Open current pages
Q: how do I keep 2-finger-scroll from going forward and back on mac? I hate it!
A: System Preferences -> Trackpad -> More Gestures -> "Swipe between pages: Scroll left or right with two fingers" -> uncheck
It worked!
The following didn't work and/or don't exist any more:
defaults write com.google.Chrome.plist AppleEnableSwipeNavigateWithScrolls -bool FALSE
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE
chrome://flags/#overscroll-history-navigation
Q: how do I upgrade chrome on mac?
A: I think Chrome -> About will show if an update is available
Q: When I run `google-chrome foo.png` from a shell, it brings up the image
in a new tab, as expected.
But when I try to open foo.png from inside google-chrome
after downloading it, it opens up some other helper viewer
that I usually don't like.
What is that helper, and how can I get chrome to just bring up
the image in a tab, instead?
PA:
The helper is called `eog` ("eye of gnome").
If, instead of clicking the .png file in the download bar, I just say ctrl-o and open it, it does the right thing.
So it's just the download bar that's weird.
Maybe one of the following is relevant?
~/.local/share/applications/mimeapps.list
/usr/share/applications/
/usr/local/share/applications/
Q: blue #0000ff was coming out as 002eff = rgb(0,46,255) on my monitor at work, according to color picker!? wtf?
maybe relevant: https://www.reddit.com/r/Fedora/comments/74h5yh/blue_shows_as_purple_in_chrome/
they suggest chrome://flags/#force-color-profile
huh, changing color profile from "Default" to sRGB fixed it.
Q: wtf does that mean?