chrome extension: how to send ‘keydown’ event to page’s input?

Your code is not working because jQuery’s keydown() method does not actually trigger a “real” keydown event. Instead, jQuery looks up the “bound” event handlers in jQuery.cache, and calls the corresponding functions. Since your content script’s jQuery object differs from the page’s jQuery object, invoking .keydown() doesn’t cause any action. In your case, I suggest … Read more

Chrome extension login best practices

You should always use OAuth 2.0 for authentication within extensions. Never pass the username/password because an attacker can simply steal such information. An example from Chromium regarding OAuth in extensions is Tutorial: OAuth. Additionally, there’s an experimental API available for OAuth 2.0, which is supposed to make the whole process a little easier. There’s a … Read more

How to inject javascript into Chrome DevTools itself

Usually, you cannot create a Chrome extension which injects code in a devtools page. The “Discover DevTools Companion” extension from now on, referred to as DDC is allowed to do this, because this extension is whitelisted in the source code of Chromium: (this is no longer the case) // Whitelist “Discover DevTools Companion” extension from … Read more

How do you integrate Universal Analytics in to Chrome Extensions?

There’s an issue for that on Google code: The solution is to pass analytics your own protocol check function or simply null for no checking, in an official way. This has to come after ga(‘create’, …) : ga(‘set’, ‘checkProtocolTask’, null); // Disable file protocol checking. So you don’t need to modify the original analytics.js script. … Read more

Registering a custom element from a chrome extension

For me it was sufficient to use @webcomponents/custom-elements package in my content.js. Also webcomponents-sd-ce.js weights about 80kb and custom-elements.min.js only 16kb. Just install it as a dependancy and import it in the content.js and let your package manager do the rest. npm i @webcomponents/custom-elements import ‘@webcomponents/custom-elements’ This is how I use it in my project … Read more