Is there an easy way to read the user's current settings?
No modification needed, verily I simply only need harmless read access.
For example
I need to discover the setting for flag ≪New omnibox answers in suggest types≫
I need to know the current default search engine (per chrome://settings/searchEngines )
Related
I'm trying to make an extension that is able to find a specific resource loaded by the page, filtering by name and downloading it. The reason I want to do this is because I usually go to the network tab in the developer tools, filter the requests/responses, for example, looking for one with the word "foobar" in its name, and open the link in a new tab so I can download it (it's an xml file).
I was wondering if this could be automated with an extension, even if the word used to filter is hardcoded.
I don't have any experience with chrome extensions, so I wondered if this could be done or if it's just not possible with the devtools api. In case it could be done, if you could give me some guidelines on how to make it I would really appreciate it.
Thanks!
There are several ways to access the information you need in an extension.
You can write a Dev Tools extension. In that case, you have access to chrome.devtools.network API which will provide you that information.
This requires you to open Dev Tools and interact with your own UI there (such as an extra tab in Dev Tools).
You can go low-level and use chrome.debugger API to attach to a page like Dev Tools would. It's a complex topic, I'm just pointing you in that direction.
Since you rely only on filtering by name, not response itself, you can use chrome.webRequest API to intercept network requests and log those that interest you for processing. This is probably simplest to do.
I am making an extension that should include in its background script some variable that should be unique for every user and that must not be altered. I was able to soolve this in Firefox since it is possible to generate the extension package inline and install it with not problems.
As far as chrome is concerned, I cannot rely on cookies, session or localstorage since the can be erased if the user deletes his browsing history.
Then my question is very simple, is it possible to pass the variable when installing the extension from chrome webstore using a link lik this for example :
https://chrome.google.com/webstore/detail/search-by-image-by-google/dajedkncpodkggklbegccjpmnglmnflm?id=somevar
YOu may use Sync Storage in Chrome: https://developer.chrome.com/extensions/storage
It use Google Drive in background to store data. Even if the user clear browser data it will remain intact.
The user will not see this data on Drive because they are not visible in the drive's UI (files are hidden) so probably he will not be able to delete it.
However you must consider a situation when the user is not logged in to Chrome or the user disabled sync options. In this scenario storage.sync will behave like storage.local.
Even when the user clear browsing data, the data stored in storage.local will remain. They will be deleted only on uninstall.
Edit:
Data are stored on Google Drive using syncFileSystem API - not storage.sync. However it doesn't change the solution I wrote.
I may be a bit of paranoid when it comes to installing chrome extension that request access to all my tabs and data. While a extension may be safe for the moment, a simple auto background update can make it a malicious virus and you won't even get notified about updates.
I would like to specifically whitelist all my extension to access the content pear webpages bases. Is there any such tool out there already (natively perhaps) before i start hacking my own extension to control it on my own.
That would leave me to my next question. Extension can be a bit secured running sandboxed environment and have no access to the "real" filesystem (not the virtual sandboxed filesystem) but could i write a NaCl plugin and have have full access and change the manifest file to change the content_scripts settings? if so, could you point me in the right direction?
I'm not sure to understand clearly your question, but let's calrify some things about extensions and how they can be dangerous:
First: If an extension updates and want to have new authorisations, Chrome will warn you and you can choose if you want it to be updated
Second: Chrome sandboxes extensions running on your computer
Third: The only authorisation that may represent a real danger for your computer are the ones requesting authorisation to "Access all data on your computer"
.
.
.
If you are really worried that some extensions may represent a danger for you (and I understand you), you can restrict them to run on specific webpages by doing the following:
1. Go to the extensions folders [C:\Users(YOUR USERNAME)\AppData\Local\Google\Chrome\User Data\Default\Extensions(APPID)] and open the manifest.json file with any text editor
2. In "content_scripts" declaration, in "matches", specify sites where the extension will ONLY work on [ex:*://google.com/* will make extension be active ONLY for google.com]
You can even be more precise and set specific URLs/HTML pages (see more: https://developer.chrome.com/extensions/match_patterns)
Hope it helps!
If it doesn't, please clarify your question again.
I need to edit and then publish my Chrome extension. I know that it sometimes takes over an hour to publish an extension, but once it has been published, can I assume that all users are using this new extension version? Or might they still be using the old one for a while? And, if so, for how long?
I publish via the Chrome dashboard. Sorry if this is the wrong place to ask. I have tried searching through Chrome's documentation.
Issue: I need to update my server side code, but if a user is still using the old extension version, then it will fail very badly.
You should not make any assumptions about the extension update frequency. The update frequency is 5 hours by default. This value can be changed by the user through the --extensions-update-frequency flag. In practice, most users will stick to the defaults though. And do not forget that it is unreasonable to expect that all of your users have their computer online all the time.
You should keep the code for the old and new version at the server's side. If you haven't done before, include a version identifier in your request. This version identifier does not need to map 1:1 to your Chrome extension version; just use a value and keep incrementing it for every significant API update.
If you did not include a version identifier in your previous version, just assume that the user is using the old version if the version identifier is missing from the request, and consistently include the version identifier in requests from your new Chrome extension.
If you have set a minimum_chrome_version in your manifest file, then the user will also be stuck at an old version of your extension if they use an older Chrome version.
Though not relevant for your specific situation, extension authors can choose to distribute their extension to a specific percentage of users via the dashboard at the Chrome Web store. When this feature is used, you obviously have users who are still using the old version.
You have to handle in your code the possibility of users having the old version. Its not published how long that might be but from experience it can be a full day at least.
According to the docs and other sources the update happens within a few hours from publishing.
Every few hours, the browser checks whether any installed extensions or apps...
The default update check frequency is several hours,
I suggest you implement a mechanism to check the version of the extension making the request and if it is not current, either fallback to differently handling the request (based on the old server-side code), or inform the user they have to update (although I would not advice that, as it might scare and annoy users).
In order to force an update of one's extension:
but you can force an update using the Extensions page's Update extensions now button.
Basically, you have to go to the Extensions page, check "Developer mode" and press the "Update extensions" button that appears.
Bottom line
I would:
Implement a mechanism to include the version in a request
Maintain two code based on the server (for a few days only)
serve each request based on the version
As the question says, can an extension save files to a user-set location for all future downloads (that differs from the download location set in preferences)?
If so, how would this be done?
Thanks
See this issue for a lengthy discussion on the matter. Per the last qualitative entry on 8.10.2012:
The downloads ui is a very sensitive part of chrome from a security
perspective, so it is unlikely that we will ever be able to allow
extensions to completely replace chrome's downloads ui. We have plans
to allow extensions to extend chrome://downloads in a limited and
safe way, and extensions may add browser action buttons, but
replacing the downloads ui entirely is not likely in the foreseeable
future. Witness the search engine hijacking security issues. With the
--disable-downloads-shelf flag, extensions could suggest that users set that flag.
Please also feel free to write a download manager extension as a
browser action to demonstrate a better ui. If a download manager
extension gains sufficient popularity, we may consider adopting
something like it as chrome's native downloads ui. That's a more
likely way that extensions could replace the ui, but slower and safer.
My guess is that you can't. It would be a security issue if plugins had such abilities.