How to add custom message in chrome infobar? - google-chrome

I used to think that this was not possible but I recently saw that Testim has an extension that does this.
Core aim: Add a message in the page which doesn't interfere with the DOM/CSS of the existing page.
Chrome/Chromium injects "The browser is being automated" message in the page when the browser is run from puppeteer. But as I understood, this isn't an editable message. How is testim able to do this?
Here's a screenshot showing exact message:

This is the message that is shown, when an Chrome extension attaches to a tab via the chrome.debugger API. It shows the name of the extension which is attached to the page, in your case the Testim Editor extension.
Removing the infobar
To remove that bar, you have can either enable the "Silent Debugging" option in the Chrome flags (chrome://flags) manually or use the --silent-debugger-extension-api flag when starting Chrome. There is no way to disable it programmatically from inside your extension.

Related

Get Chrome to open Google Cloud Storage links

I would like to be able to open a tab in Chrome and enter something like gs://bucket-name/path/to/file and have it open the corresponding page in the GCP Web Console https://console.cloud.google.com/storage/browser/bucket-name/path/to/file. I saw there are external protocol handlers in Chrome, but I don't want to open an external application. I just want it to open another page based on the URI. I also don't want to put up any of my own servers for this simple purpose. Perhaps a Chrome Extension that can do some simple JS on the URI after I enter it into the address bar?
I think it is possible now with link you gave (works for me).
#shiv turned my attention on fact that this is question about automated link replacement under the hood in address bar when you write "gs://bucket-...". So such handler just collects address and modifies it and uses modified version to go further.
Well then looks like you need something like this Set custom protocol handler in Firefox? (in case of Firefox) but unfortunately I cannot help more.

Is there a way to stop Google Chrome from showing most visited sites on a blank tab?

Whenever I open a new tab in Google Chrome I see the Google search bar plus 8 thumbnails of recently visited (or most visited) sites. I never click on the thumbnails and find them to be annoying. Is there anyway to disable this in Chrome?
I can think of a hacky workaround like creating a blank page someplace and setting that to be the new tab page, but there must be a better way. Any ideas?
Since nobody answered I thought I would post and answer to my question:
Use the Empty New Tab Page extension for a new blank tab instead of the default new tab.
There are also some redirect extensions such as Momentum, which loads a different full screen image each day.
type chrome://flags then Disable "Top Sites from Site Engagement"
Chrome allows extensions to run on chrome:// urls so one such possible future solution is if AdBlock explicitly requests the permission to run on chrome://newtab then you can just block the div with id most-visited. But currently AdBlock does not request this permission.
You could edit the manifest of AdBlock manually to include this permission or suggest it as a future feature.
The default new tap page's url is chrome-search://local-ntp/local-ntp.html. You can press F12 to check it. It's a local resource located in
C:\Program Files (x86)\Google\Chrome\Application\{Version}\resources.pak
or
C:\Users\%username%\AppData\Local\Google\Chrome\Application\{Version}\resources.pak
Open it with a HEX editor, search text
cur.style.opacity = 1.0
, and replace it with
cur.style.opacity = 0.0
Tested on Chrome 77.0.3865.90 .

Chrome extension can't get access to chrome://extension-icon

I'm trying to list other extensions from my Chrome extension, and show their icons.
Another extension (Zenmate VPN) shows other's icons easily. I figured out that it has management permission in it's manifest.
I add "management" to optional_permissions and ask user to enable it after a click.
After that, I can list extensions, but the icons are still unaccessible in the page.
When I add management to permissions section, everything works fine. The problem is that we don't want to add this permission there, because Chrome will disable the extension by default if the updated version asks for more permisssions.
Is there a way to somehow refresh permissions in a page, in order to make icon URLs work (chrome://extension-icon/*), like they work in ZenMate?
If you already have chrome://favicon permission you can use it to display an extension favicon:
<img src="chrome://favicon/chrome-extension://igiofjhpmpihnifddep‌​npngfjhkfenbp/">
In case you didn't have chrome://favicon permission initially, try adding it in optional_permissions. If it won't work, try adding to permissions but first test if it'll disable your extension on update.
Other icon sizes may be specified (in the absence of an actual big icon the default 16x16px is scaled):
Retina 2x DPI: chrome://favicon/size/16#2x/chrome-extension://.......
48px: chrome://favicon/size/48/chrome-extension://.......
I checked if I could go with wOxxOm's answer, and mostly extensions did not have bigger favicons, nor I can request chrome://favicon/* permission: Chrome throws an exeption:
Unchecked runtime.lastError while running permissions.request: 'chrome://favicon/*' is not a recognized permission.
So I found a simple and robust solution: I just close the current tab and create a new one:
permissionsAchieved = function(allowed) {
chrome.tabs.create({ url: "<write current url here>" });
window.close();
},
Done. In the newly opened tab, the icon is shown correctly.
But thanks for a suggestion!

Script tab in firebug equivalent for chrome

I'd like to be able to set break points on JS in individual files. I can do this to inline script in chrome with sources tab. This is isn't very helpful as I have almost no inline JS.
In firebug you have the script tab, in which you can select from all the js files on the site.
Where is Chrome's version of the Script tab in Firebug?
It is not clear what is the problem.
Chrome has DeveloperTools. It can be invoked with help of Ctrl+I (Cmd+I on Mac) shortcut or though menu.
In the DevTools window there is Sources tab that can show you the js files of the site.
You can use Ctrl+O shortcut for opening a particular file.
Or you can use sources tree pane.
If the source file is obfuscated/minified then you could pretty print it with help of a button in the status bar with curly bracers. Also DevTools supports source maps. You can set a breakpoint in the js file and do number of other things typical for an IDE.

Creating a Badge-less Google Chrome Extension

According to the docs I have made an Google Chrome Extension that I would describe as a "browser action" because it is present on all pages. However, my extension doesn't require any interaction so having a badge next to the omnibox is pretty wasteful. I have installed extensions that do not appear anywhere (except maybe in the context menu). How is that done and is that best practice?
Having page action or browser action icons is totally optional if you don't have any popup attached to them, so just remove the whole browser_action section from your manifest file.