Chome API manifest dynamic url permission based on default search engine? - google-chrome

Is there a way to extract the url for the default search engine (for omnibox) and then include that within the URL permissions scope?

Quick answer is no, there is no such API to do that. Unless you want to use a NPAPI plugin, which can basically do anything. If so then you can access the default search engine by reading chrome files, according to this post, it's in a sqlite database.

Related

What is the internal file format of a .glink file?

I would like to add URL links into a web-based Google Drive folder. Searching online, it appears that this was once possible with files that ended in a .glink extension. I'm looking for documentation on the file format so that I can create them programmatically.
[EDIT] Why do I want to create .glink files? Because I want links (bookmarks, URLs) to be able to appear in my Google Drive web page and to be able to click on them an go to the page. Microsoft OneDrive supports this functionality.
GLINKS Files
The URL link file feature was available due to a workaround with Back Up and Sync before being deprecated with Drive for Desktop. The .glink seems to be patched and no longer available as it was also part of a third party tool no longer available. It seems it now only saves them as .URL and automatically gives it the icon for Google Docs, as it would take it as a simple file with text.
Checking the .url type file of Windows, when uploading to Drive it does not update as it should, even utilizing Drive for Desktop (as an alternative to sync data like back up and sync) the outcome is the one suggested above.
This is the main reason why there is no longer any documentation about the matter, due to this one not being an official feature and being also fully deleted, it can be confirm by the file type available when creating files with the Drive API:
https://developers.google.com/drive/api/guides/ref-export-formats
I would suggest to request a feature to allow this or to provide a new way to store URL links as before or report it to review if possible any references on how it used to work by submitting a feature request or checking the issue tracker about the matter:
https://issuetracker.google.com/issues/new?component=191650&template=824106
You can also add the details of the previous threads or discussions about the GLINKS.

Change browser search engine for every user/machine in windows domain

I want every workstation in my school to have Ecosia as their default search engine.
If one wants to change his search engine to Ecosia on his home computer with Firefox he needs to add the extension to his Firefox profile and change his default search engine to the then added option "Ecosia"
But it is hard to do this for every user in our Windows domain automatically.
My easiest option would be to deploy a script to modify the Firefox(Chrome/Edge) installation but didn't find a way to change the configured search engine. Adding the extension seems to be no problem.
Also I can not change anything in the user files as they are not saved locally but on the domain controller. (Otherwise I could just overwrite the users Firefox profiles)
Some of the other options to deploy custom Firefox installers in companies included preinstalled extensions but I haven't found a configuration that included the search engine configuration.
I want to change the search preferences in Firefox, Chrome and Edge. Firefox alone is driving me crazy.
But there must be a way to achieve this as many viruses doing search hijacking change your search engine without problems event though i was not able to find any source code of those.
So in the end the question is:
Is there a way to add an extension and change the search engine of Firefox/Chrome/Edge without touching the user data or is there a way to preconfigure installers to include a different standard search engine?
I'm kinda desperate by now, so any approach is welcome.
To be specific:
My school has about 200 computers with Windows7/Windows10
combined in a windows domain. Each Student has his own account.
The system for distributing software installers/scripts is opsi
If you use Firefox ESR, you can set up search engines via GPO.
You can add a search engine as part of your web extension via chrome_settings_overrides.search_engine in the extension's manifest (example); making it the default will prompt the user.
The way "viruses [are] doing search hijacking change" is probably by storing the search plugin file to searchplugins and updating the user preferences file.

Chrome Extension and IndexDB Integration

So, I am working on a project(building a chrome extension) that requires data to be stored on the local machine of the user. The size of data is quite large hence I thought of using IndexDB for this purpose.
My Question is whether is it possible to connect a chrome extension with IndexDB and query the database at the same time??
If Yes, Then how can I integrate them. In which file(popup.js or background.js or any other file) should I include the source code for creating the database.
I want the code for creating the database to run only once. After that I only want to update or delete data only.
If No, then is there any other way to achieve this?? The data is large hence I cannot store data in local storage.
Any paper, online material, advice or method from chrome developers or any other valid site would be helpful. Any example would help me alot.
Thankyou.
You can store tons of data in any HTML5 storage (including IndexedDB or localStorage) and chrome.storage.local with "unlimitedStorage" permission.
HTML5 data is stored per URL origin and each extension has its own one that looks like chrome-extension://id where id is a 32-character string that is the extension's id. In Firefox the origin looks like moz-extension://id.
Extension's own HTML5 storage:
can be accessed in any extension page (popup, options, background) just like you would do it in a web page, there are no differences.
cannot be accessed in a content script as it runs in a web page and thus can only access HTML5 storage of the web page's URL origin.
chrome.storage.local can be accessed in any extension page and in a content script.
No need for special event to create/upgrade your IndexedDB storage - it'll happen automatically if needed - simply open it as shown in the documentation whenever you need to access it and your onupgradeneeded callback will be invoked in case there was no DB or it was outdated.
Use a wrapper library for IndexedDB that provides a simplified syntax. Some are listed in the documentation, but you can probably find better ones yourself.

Add suggestion URL for custom search engine in chrome

I have a local search engine backed by a elasticsearch and a thin nodejs API for search. I want to be able to search those documents from Google Chrome (builds available from Google, not Chromium) directly. In this use case, I will use chrome ONLY with this search engine, so I don't want to use OmniBox keyword search API. I want the same behavior as I get while choosing the default search engine in chrome. Which is
Start typing in the OmniBox and it shows a list of suggestions.
Hit enter and it takes to the search results page
I got the #2 working by adding a new search engine under settings and providing the search api's url. I can't get #1 working.
The two urls exposed by my server are:
http://localhost:3000/complete?query=my (this returns a list of search suggestions which I want to show while typing in OmniBox).
http://localhost:3000/results?query=my+sample+query (this returns the actual search results as a web page, this is working)
Things that I have tried:
Added search engine using window.externals.AddSearchProvider with OpenSearchDescription.xml link. The XML has suggestions url as well.
Tried writing a background extension with OmniBox but it does not allow me to search without using a keyword
I searched through Chromium and found this JSON file
https://code.google.com/p/chromium/codesearch#chromium/src/components/search_engines/prepopulated_engines.json&q=prepopulated&sq=package:chromium&l=1
But I don't know how can I use it (or if its even possible to do this in official builds of Chrome).
I finally found the solution.
The opensearch.xml document reference can be used as a link in the head section of the HTML page. It contains two URL schemes, one for search results and other for suggestions.
The details can be found here:
Opensearch Document Specs.
As soon as I updated my index.html and opened the page in Chrome, Chrome automatically added a new search engine. It didn't show that there is a suggestions URL under Settings > Manage search engines.
Next, I chose my engine as the default search engine by clicking on Make Default and done! Now I can see all the search suggestions in the omnibox without using a keyword.
There is a Setting Overrides mechanism for Chrome Extensions, which is not widely known, which can achieve what you want, but:
At least according to the docs, it only works on Windows and Mac.
You won't be able to publish the extension unless you can verify the site in Webmaster Tools. Otherwise, you are stuck with unpacked installs.

Google Docs View - URL Encoding?

I'm trying to use the Google Docs Viewer. It seems to work fine for PPT. Example this works:
http://docs.google.com/viewer?url=http://www.microsoft.com/presspass/download/press/2008/02-01yahoo.ppt
In my app I have files uploaded as private for security. This appears to be breaking Google Docs or maybe I'm encoding something wrong.
The URL I'm sending to Google Docs Viewer is like so (sample URL):
https://s3.amazonaws.com/dev/1/attachments/243/1/original/02-01yahoo.ppt?AWSAccessKeyId=17VVCSSS3H6Y3129H3G2&Expires=1294131584&Signature=3141havYNS7JCpsTLE6Ppo3yXkc%3D
That breaks google docs, it can take it. Do I need to encode this differently?
Thanks!
You need to encode at least the ampersands (&) to %26
In whatever language you are using there should be a function for url encoding. In php it is urlencode(). In javascript you will want to use encodeURIComponent()
You can't. Your documents must be publicly accessible for Google's servers to view them and render them. When I try to view the URL you posted, it gives me "Access Denied."
Imagine trying to view a powerpoint on your computer at /Users/you/Desktop/mypowerpoint.ppt. Since it's not a publicly accessible file, you wouldn't expect anyone to be able to view it, let alone Google's servers. Google would not be able to access http://docs.google.com/viewer?url=file:///Users/you/Desktop/mypowerpoint.ppt, just like it can't get to your Access-Restricted page.
If, however, the URL you provide has an access key (which I see is a part of your "sample url") which allows anyone with that access key to view it, it should work, and #Mike is right -- you will need to URL encode it so as to not confuse Amazon's URL parameters with the Google Docs Viewer's parameters. In that case, if you're working with Ruby on Rails, which your history of questions suggestions, you'll want to use
<%=u "http://www.yoururl.com/?someparameter=true&file=myfile.ppt" %>
Well you can do this if you can download the files from the instant url generated by s3 php library. All you have tp do is to put google url + encoded ( instant generated file ).
Google view will be able to read it if the link is not expired.
that's it
$generated_file = $obj->gs_prepareS3URL($file);
$encoded_url = rawurlencode($generated_file);
$google_docs = "http://docs.google.com/viewer?url=";
redirect($google_docs.$encoded_url);