chrome-extensions | Chrome extensions - | Browser Plugin library
kandi X-RAY | chrome-extensions Summary
kandi X-RAY | chrome-extensions Summary
Chrome extensions
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of chrome-extensions
chrome-extensions Key Features
chrome-extensions Examples and Code Snippets
Community Discussions
Trending Discussions on chrome-extensions
QUESTION
I have a piece of code which works fine on chrome. I did the following step mentioned here. I'm able to load it properly, but the code doesn't run properly. In the background console only the url gets printed, no other consoles or alerts work. Please any help will be appreciated ! Please
...ANSWER
Answered 2020-May-15 at 06:06I tested and found that if we remove window.onload
then the extension will work well in Edge Legacy. It will print all the consoles.
You could set content.script run at document_idle
. It's equal to window.onload
and you do not need to listen for the window.onload
event. For more detailed information, you could refer to this article.
My manifest.json is like below:
QUESTION
I know there are a lot of similar questions : Chrome extension messaging: sendResponse returning empty object, etc., but I read and tried all of them before asking my question. My problem is a bit different, so I think that's why their solutions don't work for me.
I want to detect Ctrl+C from the user, so when he clicks on extension icon, the content of the clipboard is displayed inside the popup.
Here's what I've done : a part of manifest.json :
...ANSWER
Answered 2020-Apr-07 at 09:36The actual cause of the problem is that extension.onMessage is a deprecated alias for runtime.onMessage so you have two listeners for the same event but only the first registered listener's sendResponse is transferred to the caller and that is {}
.
That said, the entire workflow can be extremely simplified: there's no need for the background script or the content script so you can remove "background" and "content_scripts" from manifest.json. No need for messaging either.
You need a browser_action popup and simply read the clipboard in the popup script.
manifest.json:
QUESTION
I'm trying to use Google Cloud Print(GCP) API, but I can't make it works. Maybe I've understood bad the workflow because is the first time I'm using the google api, please help me to understand how to make it works.
Initial considerations:
- I'm trying to implement it in reactJS, but It is indifferent because the logic to make GCP works is independent of the technology. Then you also can help me understand the workflow.
What exactly I want:
To make my first test, I am looking to get all information about my printer.
What I did:
- I created a project in: https://console.developers.google.com
- Inside the project created, I created a credential:
- create credentials -> OAuth client ID
And I chose Application type: Web, and also configure the restrictions to source and redirection to my localhost.
Manually in https://www.google.com/cloudprint, I added my printer, I made a test printing a PDF and was OK.
I created a project in reactJS to get the information of my printer I've added.
Component:
Explanation:
I'm using a component
react-google-login
to obtain easily the user accessToken: https://github.com/anthonyjgrove/react-google-loginThis component only obtains the access token and save it in localStorage, in a variable called
googleToken
and it draws a button to call a function to obtain the information about the printer.
code:
...ANSWER
Answered 2017-Dec-02 at 22:54I've resolved my problem, my main problem about User Credential required
were because I was using the incorrect access token and It was because I was getting the access token incorrectly.
I'm going to explain my whole solution because there are few examples of codes with this API.
Solutions:
The steps described were Ok until the fourth step where I used the external component
react-google-login
to trying to get the access token, instead I usedgoogleapis
module: Link Github googleapisAlso to avoid CORS problem(and not use CORS chrome plugin) I wrote the requests to Google API in server side.(NODEJS)
I had also a problem in the frontend when I tried to generate a popup to give permission for printer(problems about CORS), my solution was to use this very simple module for authentication: Link Github oauth-open
General scheme:
Explanation:
Knowing I have all data described in my question post(until the third step).
Authentication:
The next step in getting a URL and use it to the user can authenticate. As I said before I used the module
oauth-open
in the frontend to generate the popup and only this module need the URL. To get the URL in the backend I used the endpoint/googleurl
, where here I used the methodgenerateAuthUrl
of the modulegoogleapis
to generate the URL.After that In the frontend, I got the
authentication_code
(that returned the moduleoauth-open
), I send It to my endpoint/googletoken
and here I process theauthentication_code
to generateaccess token
,refresh token
andexpiration date
with the methodgetToken
of the modulegoogleapis
. Finally, these data are stored in the database.
Print:
For print, since the frontend, I send what data I need send to the printer. I used my endpoint
/print
In the backend endpoint, my logic was the next:
Recover tokens and expiration date from database, with the expiration date check if the token has expired, and if It has already expired then gets another token and replace the old access token
with the new one, replacing also with the new expiration date
, to obtain this new data only is necessary call to method refreshAccessToken
of module googleapis
.Note: the refresh token never expires.
After having the access token updated, use it to send data to the printer with Google route(.../submit
)
Code:
- All the next codes are in only 1 file
- Some data as validation, static variables, error handler, etc, has been removed to better understanding.
Route get URL authentication.
QUESTION
I have built a Chrome extension that I have been installing into Chrome using Selenium.
Now I would like to build my own Chromium from source so that my extension is pre-bundled into the built distributed package so that I don't have to worry about needing Selenium to install the CRX file for my use case.
I have found several forums where people suggested they were going to try this, but none of them ended up seeming like they were successful.
I found some tips on how a system administrator can force install extensions into chromium for users in their network: https://support.google.com/chrome/a/answer/6306504?hl=en But that is for chrome enterprise, probably not going to be useful for me.
Here is another post which talks about how to offline install chrome extensions. I might be able to use some of this to make what I want happen.
Has anyone had success actually building into chromium a CRX so that the CRX is just installed automatically?
Quick update:
I just want to note: I'm installing my custom version of chrome with an InnoSetup installer. So I do have the chance to, after my chromium fork is installed, do some custom execution steps post install. And my extensions are hosted on the chrome web store and approved.
So if there is some way to programmatically install chrome extensions into a Chromium installation from the web store, I would could easily use that.
...ANSWER
Answered 2018-Jun-18 at 09:07This has been tested in our Chromium fork version 66.0.3359.139 on Windows 10. The extension bundling process might be different for Linux and OS X. I have also tried to make it as easy as possible to accomplish this task. There are a couple of things you will have to do to accomplish this:
- Add your Chromium extension (.crx) file to a list of default extensions to bundle with mini installer
- Find out the ID of that extension
- Automate plugin installation process
- By pass Chrome Web Store check
- Build mini installer to install your Chromium fork
1: To bundle your extension with the installer, you will have to modify: src\chrome\browser\extensions\default_extensions\BUILD.gn
file. Suppose tab_capture.crx
is your extension then it's contents should look something like this:
QUESTION
I used to be able to (locally) use either of the following two Chrome extensions to easily inject jQuery into pages that didn't already have jQuery, and that I didn't own (client-side) to experiment with design changes, development modifications, and real-time troubleshooting:
Unfortunately, now because of what appears to be the newest craze in preventing "XSS" (cross-site scripting), those plugins no longer work. There may be a noble purpose behind these changes, and I'm just trying to understand WHAT changed. I think it has something to do with "content security policy", which I've only recently heard of and have very little knowledge of.
I first learned about XSS as a browser issue in 2011, however, XSS prevention measures had never prevented me from doing local development before. I've been searching for a modern (late 2017) solution, to no avail.
I'm not sure where to go from here.
WHAT I'VE TRIED THAT HASN'T WORKEDHere are plugins I tried (which used to work until about 6 months ago) that no longer work for me:
- jQuery in Console (Plugin)
- jQuery Inject (Plugin)
- jQuery Injector (Plugin)
- GitHub - bluerabbit/jquery-inject: jQuery-inject(Chrome extension)
Here are some of the many links I encountered that offer solutions which no longer work:
- How to inject script into a page using bookmarklet if the Content Security Policy is enabled on the server?
- Include jQuery in the JavaScript Console
- How to inject jquery to any webpage
- How do I include a JavaScript file in another JavaScript file?
- Google Chrome Extensions: How to include jQuery in programmatically injected content script?
- Inject jQuery Onto Any Site | brandon martinez
- Content Scripts - Google Chrome
This last one also looks promising, but I haven't tried it yet:
MY QUESTIONSHow can I inject jQuery (using Chrome Developer Console) into a webpage that doesn't use jQuery?
Did something change in the browser/JavaScript/programming world significantly enough in 2017 that if a person knew about this particular change or phenomena it would easily explain why the above plugins no longer work?
Why don't the above plugins work? Did ALL the browser companies universally roll out some major change this year?
ANSWER
Answered 2017-Dec-27 at 21:39You can make a very basic chrome extension which just injects JQuery on every page. Getting started with chrome extensions. You can specify that in the manifest itself using this piece of code.
QUESTION
After the review of my Edge extension I got the approval to submit it into the store. However the submission failed with this error.
File specified by 'background.page' does not exist: Extension\PopupApplication\app\index.html?background=1
Validation failed for extension manifest: Extension\manifest.json
The relevant part in the manifest.json
looks like:
ANSWER
Answered 2019-Apr-01 at 07:00The fix was to change our code to successful submit the edge extension. The submission does not allow query parameters in the background.page
property. This was confirmed by the Microsoft support.
QUESTION
We'd like to develop a Google Chrome extension that is managed centrally, e.g. by MS Active Directory Group Policies.
How do we centrally distribute domain/customer specific configuration for such an extension?
Our users are mostly Windows users in the same domain, but we can not assume that they're logged in to any particular G-Suite organisation.
It does seem possible to create Active Directory Group Policies to install a particular extension for all users. That same article does however say:
Unfortunately I was not able to come up with a solution concerning the centralized management of Chrome extension settings. Some extensions, for example The Great Suspender, come with additional options for the user to configure. As said, I was not able to find a way how to manage or configure these centrally.
So now that the extension is installed, how do we configure it?
Since it is our own extension, there is more freedom. I'm thinking with a Group Policy, one could install C:\some\extension-file.json
and then run
ANSWER
Answered 2018-Nov-14 at 15:40How do we centrally distribute domain/customer specific configuration for such an extension?
chrome.storage.managed
is the specific answer for that need. Quoting the docs:
Enterprise policies configured by the administrator for the extension can be read (using storage.managed with a schema).
With that in mind, you have to do the following:
Provide a schema for the storage via the
storage.managed_schema
key in the manifest. An example is given in the documentation.Present values expected by the schema via GPO / registry as described in admin docs.
You can verify that the policy-mandated values are loaded by observing chrome://policy
.
You can then use chrome.storage.managed
as you would any other chrome.storage
(though it is read-only), including watching for changes with onChanged
.
QUESTION
I have built a chrome extension and I'm getting hit by a race condition that I need help with.
If you see the answer chrome extension: sharing an object between content scripts and background script it tells us that you cannot share a variable between content and background scripts.
My goal is to generate a unique ID per-browser tab and then share it in between the content.js
and the background.js
. Then I need to use this value in a content injected javascript as explained in this answer: In Chrome extensions, can you force some javascript to be injected before everything?
The only way I have been able to figure out how to do this is by doing the following async code then I just use the tab ID as the unique ID:
content.js
...ANSWER
Answered 2018-Nov-06 at 14:21This question was already answered previously, although it is hard to tell that this is the same issue at first glance.
https://stackoverflow.com/a/45105934
The answer is pretty descriptive so give it a read.
Here is the script changes that make it work:
QUESTION
In my Content Script, I have an element (an a
tag, to be more specific) and I need to add an event to it. The event handler, however, is defined in the page JS, and I dont know how to attach it to the event of my element in the extension. What I want to achieve is:
ANSWER
Answered 2018-Oct-24 at 14:32According to the MDN reference there is a way for page and content scripts to communicate with each other.
In Firefox*, DOM objects in content scripts get an extra property
wrappedJSObject
. This is an "unwrapped" version of the object, which includes any changes made to that object by any page scripts.
Now, in your code, you're immediately calling the function rather than passing the listener a reference. To solve this you should wrap your function call in an arrow function to prevent this:
QUESTION
I am the developer of a WebExtension for Chrome. The WebExtension is not listed in the Chrome Web Store because it is only used for internal purposes.
When packaging the first version of the WebExtension I got a pem file which contains a private key. Currently, I am using chrome.exe to create/sign new releases of my WebExtension using my private key.
I have noticed that the file is not protected by a passphrase and contains the private key in plaintext. I think it is handled that way to simplify the packaging process for developers. However, I am concerned about the security of my private key. Therefore, I want to protect my private key with a passphrase.
I guess that chrome.exe will expect a pem file containing a plaintext private key so I have searched for alternatives to sign my WebExtension and found the following:
- A bash script http://www.adambarth.com/experimental/crx/docs/crx.html
- A python script https://grack.com/blog/2009/11/09/packing-chrome-extensions-in-python/
Both of them using openssl. Hence, handling of an encrypted private key can be added but I am not very experienced using openssl.
Do common/best practice openssl commands exists for encrypting and decrypting a pem file?
Any help will be appreciated, thanks!
...ANSWER
Answered 2018-Sep-17 at 15:05Encrypt a key with a passphrase:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install chrome-extensions
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page