Chrome extension that changes values in the Preferences file - javascript

I'm trying to write a chrome extension that auto-hides the bookmark bar and shows it when you hover over that area. I was able to do this through c++ by listening to the cursor location and using the ctrl-shift-b shortcut. Unfortunately this is not feasible using the extensions API so I'll have to find another solution.
Would it be possible to do this by changing the value of show_on_all_tabs to true in Preferences?
"bookmark_bar":{"show_apps_shortcut":false,"show_on_all_tabs":false}
If so, then how would I go about implementing that in my extension?
Thanks

There's no API available to Google Chrome extensions to change/hook/control the browser UI.
Other Chromium-based browsers may have something of the kind like Opera's sidebar API.
Changing any of the internal files like the Preferences is also not allowed. It's hard to change even externally as you'd need to change Secure Preferences too, properly updating its hashsum.
Sending Ctrl+Shift+B hotkey from inside an extension/webpage is fruitless as well as it will never escape the content sandbox, and won't reach the browser's internal event listener.

Related

Record current tab in chrome using chrome extension and getUserMedia()

I am trying to make a Chrome extension to record user activity in the current tab.
I found out that I can use getUserMedia() on the front, and chrome.desktopCapture in my background script.
However, when I try to use chrome.desktopCapture.chooseDesktopMedia(['tab'], onApproved), I get prompted for the tab I want to share. However, I would like to skip this step and share my current tab without the prompt.
I know that this can be done, because in the Screencastify Chrome extension, you can do that. The first option is to record the current tab and no popups are displayed.
Have you taken a look at chrome.tabCapture API? It can be used inside of an extension, and unlike the chrome.desktopCapture API can be called programmatically without a prompt. The limitation is that the chrome.tabCapture API can only be used within an extension, and cannot be used within a Chrome packaged app (tested and verified in my own attempts at using the "tabCapture" permission in a custom packaged app). So, if you are just writing an extension, the chrome.tabCapture API might be your best option.

How to add eventlistener on keypress to chrome's address bar - Chrome extension

Is there an API for google chrome extension that lets me add an event listener on key press in address bar?
I tried searching on the web, couldn't find anything.
No, unlike Firefox, Chrome doesn't expose its UI to extensions.
The only remotely related options are:
omnibox API to add a keyword search.
When the user enters your extension's keyword, the user starts interacting solely with your extension. Each keystroke is sent to your extension, and you can provide suggestions in response. The suggestions can be richly formatted in a variety of ways. When the user accepts a suggestion, your extension is notified and can take action.
commands API to register a hotkey for the extension that will work everywhere, including the omnibox but the extension won't be able to read anything from it.
webNavigation.onBeforeNavigate or webRequest.onBeforeRequest in case the prediction service is enabled - impossible since Chrome 71

Detect Eddystone-URL directly from Chrome Browser

is there a client based javascript way to detect Eddystone-URL beacons directly from the Chrome browser in iOS?
I know Chrome has the widget for the today view wich works fine, but I need to detect new Eddystones without pulling down the notifcations window.
Say a user clicks on a link provided by the widget, gets redirected to the Chrome app, does stuff, walks around and gets in range from another beacon.
Right now he would have to pull down the tab again to receive the new URI. But I need some sort of notification from within the Browser.
I hope you get the idea.
Thanks in advance!
Cheers
p.
Unfortunately, this is not possible. Understand that Chrome for iOS is just a thin app around the standard native iOS UIWebView, so there is nothing you can do in JavaScript that you cannot do in Safari. And Apple does not implemented any JavaScript bindings to the CoreBluetooth APIs that would be needed to detect Eddystone-URL beacons. The bottleneck is more of an iOS restriction than a Chrome browser one.
Note that this is not true for the Chrome browser on other platforms, notably ChromeOS, which does provide such JavaScript APIs.

Command line chrome extension loading and testing

I'm currently using the "Developer mode" on the chrome://extensions page of the chromium browser, loading it by clicking on "Reload (Ctrl+R)".
I'd like to be able to make a change to my unpacked chrome extension and load it into the browser in an automated way, especially since I'm testing the extension on a virtual machine so doing all this completely headlessly would be ideal. However, I would at least like to avoid having to click every time I want to load my extension, and I'd like to be able to collect any errors produced into a file/tty.
What is the best way of doing this? Does chrome provide tools for automating extension building and testing?
Regarding the other question linked below:
It doesn't really address my problem, since I am looking for a way to get console output, stack traces and any output generated by the extension reload to be accessible via a file/stream in my OS, as opposed to being displayed in a chromium browser window. The linked answers provide a way to reload the extension programmatically, but not much else.
There are a few avenues for you to research.
You could look into enabling logging with a high verbosity. In principle, I would think there is a level that echoes console output; I'm no expert though.
You could use Native Messaging to speak to a daemon that will log things for you; the downside is that you probably can't catch errors this way.
You could take this one step further and create an extension that attaches to your target extension with Remote Debugging protocol (which provides the same info as DevTools) using the chrome.debugger API, and then log stuff with Native Messaging.
Or, you could eschew using an extension as a supervisor and just use/write an external Remote Debugging client.

Any Javascript functions to get homepage ,search provider ,favourites etc from browsers like Firefox and google chrome

my application is setting browserhome page ,search provider ,favourites etc to all supported browsers like googlechrome,firefox,internet explorer.My purpose is to automate my application using selenium .In case of IE these informationa are stored in registry . so it is easy for me to validate the above details .But for firefox and google chrome its bit problem .So i just want know whether there is any functions available in javascript to check browser homepage ,search provider,favourites etc in firefox and google chrome ?
The simple answer is no. It would be a security and privacy issue if client side js code could access that information. Instead you would need to use a browser extension, or in your case you can just use an external program with administrative rights. I am pretty sure that selenium does not have this functionality built in, however it is all available if you know where the browser stores it. IE uses the registry, but chrome and Firefox use proprietary files in their profile directories. There may be an library that does this, otherwise it is possible

Categories

Resources