Capture a mouse-up event with a chrome extension - google-chrome-extension

Is it possible to capture a mouse-up event on any given page when using a chrome extension? I know that the API allows you to interact with the DOM, and I'd like to recreate the behavior of the standard onMouseUp event, but I'm not quite sure if it can be done when used through a chrome extension

Related

How to get content-transfer [size] information like in devtools network tab?

I want to get the content-transfer size like in chrome devtool network tab through chrome extension API but it doesn't have events for this.
Also checked webRequest API.
Low-level precise approach
DevTools itself uses CDP (Chrome DevTools Protocol) events like Network.responseReceived and its encodedDataLength field (source).
It can be used in an extension via chrome.debugger API:
attach the debugger to the tab
navigate it to the URL or call chrome.tabs.reload()
send debugger command Network.enable
register an event listener for Network.responseReceived
detect the moment the page is loaded by using a sliding timeout aka debounce
An annoying side-effect is that Chrome shows a warning in all tabs when the debugger is used by an extension. If you need more info, search for chrome.debugger examples yourself (here's a few official ones) and inspect the source code of devtools.
Content-Length approach
Another approach is to use Content-Length HTTP header but it's not guaranteed to be present on all responses: here's an example that you can further enhance with a check for fromCache field that's provided in a separate onCompleted event.

Develop a chrome extension to capture clicks using chrome extension api

I am trying to develop a chrome extension which can capture clicks using chrome extension APIs not by JavaScript.
If you want to capture the 'click' events in chrome extension, this answer might help you from the question - How may I get the element attributes (text, id, class and so on..) of the current tab, out of a mouse click, from a chrome extension?
In your content.js, write the following code-
$(window).click(function(event) {
console.log("Click event: ", event);
});
Content scripts are files that run in the context of web pages. By using the standard Document Object Model (DOM), they are able to read details of the web pages the browser visits, make changes to them and pass information to their parent extension.

Method to autoupdate Chrome Extension badge

I'm building a Chrome extension that makes the badge show a number returned from an API. I have the code working fine, but I have it listening for DOMContentLoaded, so it only updates when the user opens up the extension.
I would like the extension to check the API every time the browser loads a page. I do not need to change anything in the page, I just want to use it for timing.
I'm not sure what I should be using, should I be using background pages, event pages, or something else? What would be the best way to go about this?
Thanks in advance!
The api you want for “every time the browser loads a page” is chrome.tabs.onUpdated. You’d have:
chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab) {
chrome.browserAction.setBadgeText({"text":"ABCD","tabId":tabId});
});
An easy approach for development is to use a background page, get it working, and then figure out what changes you need to convert it to an event page. With this stub however, nothing is stopping you from making it an event page.

Google Slides viewer finish event

i'm using google slide in a embedded iframe, I've published it and I'm able to autostart but i can only autoloop or stop it once finished.I'd like, for example, to change iframe content once finished, there's a way or an api for google viewer to send an event once my presentation is finished.
Thanks
You can write a short/simple chrome extension that will do that.
Or use this extension: https://chrome.google.com/webstore/detail/auto-reload/ofojbjgaaddibdfpmmjeonahgbacejid

Accessing browser events in chrome extension - DOM events in chrome extension

I am writing a chrome plugin in which I would like to receive events such as "load", "unload" of window and page. However, I'm not getting any concrete clue to start with.
Can anyone tell me how to capture DOM event in plugin?
Does Chrome support this feature?
Thank you.
You would need Content Scripts and you just add normal browser events to the JavaScript you inject as you stated in your question. Every page will have that content script and it will listen on those events.

Resources