google-chrome-extension

Simple example for NPAPI plugin

可紊 提交于 2020-01-03 05:15:13
问题 I'm trying to find a simple example on how to write an NPAPI plugin that will be bundled with my Chrome extension. The thing I need to do with the NPAPI is simply to run an already existing local program that I have the local path for. Could not find any simple examples that will allow me to do this. 回答1: The firebreath NPAPI framework seems to have decent documentation: http://www.firebreath.org/display/documentation/FireBreath+Home 回答2: I start from OSX https://github.com/niw/open_with

How do I build a PPAPI plugin on Linux?

折月煮酒 提交于 2020-01-03 02:50:09
问题 How do I build a PPAPI plugin for Chromium on Linux? For example, I want to build the stub example provided by the project. http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/examples/stub/stub.cc?view=markup So far I have the following Makefile libexample.so.1.0.1:example.o g++ -shared -Wl,-soname,libexample.so.1 -o libexample.so.1.0.1 example.o -lc -lppapi_cpp -lppapi_cpp_objects -L /home/carlos/Desktop/ppapi/example/ example.o: g++ -fPIC -Wall -g -c stub.cc -o example.o -I /home/carlos

How to get content script run on page's update and url's change?

北城余情 提交于 2020-01-03 00:53:28
问题 My content script runs only on one domain. But if I use only one tab, content script runs only 1 time. I want my script to run on every new request (page reload and URL changes for example from bla.com/home to bla.com/servoce etc.). 回答1: The content script can listen for page changes. There's a few ways to do this, but my guess is you want the onUpdated event in chrome.tabs: chrome.tabs.onUpdated.addListener(function callback) There's more details on this here: https://developer.chrome.com

chrome.extension sometimes undefined in background js

核能气质少年 提交于 2020-01-02 19:13:49
问题 [EDIT] I have reduced my failing code to a much smaller case. See https://github.com/deg/tmp-chrome-extension-bug This is a slightly modified copy of https://developer.chrome.com/extensions/getstarted, changed to include a content script and background page. Even in this simple extension, chrome.runtime.id is sometimes undefined. It looks like a timing problem. Instructions to reproduce are the repo readme. [ORIGINAL TEXT] I have a chrome extension with a background script "background.js" In

return value of chrome.webRequest.onBeforeRequest based on data in chrome.storage

纵然是瞬间 提交于 2020-01-02 10:45:21
问题 I am trying to to block certain webrequests in my google chrome extension based on data stored in chrome.storage.local. However I can't find a way to return "{cancel: true };" inside the callback function of onBeforeRequest.addListener. Or to access data from storage.local outside of it's respective callback function due to the asynchronous way of chrome.Storage.local.get(). Here is my relevant code. chrome.webRequest.onBeforeRequest.addListener( function(info) { chrome.storage.local.get(

return value of chrome.webRequest.onBeforeRequest based on data in chrome.storage

给你一囗甜甜゛ 提交于 2020-01-02 10:43:57
问题 I am trying to to block certain webrequests in my google chrome extension based on data stored in chrome.storage.local. However I can't find a way to return "{cancel: true };" inside the callback function of onBeforeRequest.addListener. Or to access data from storage.local outside of it's respective callback function due to the asynchronous way of chrome.Storage.local.get(). Here is my relevant code. chrome.webRequest.onBeforeRequest.addListener( function(info) { chrome.storage.local.get(

return value of chrome.webRequest.onBeforeRequest based on data in chrome.storage

落花浮王杯 提交于 2020-01-02 10:43:34
问题 I am trying to to block certain webrequests in my google chrome extension based on data stored in chrome.storage.local. However I can't find a way to return "{cancel: true };" inside the callback function of onBeforeRequest.addListener. Or to access data from storage.local outside of it's respective callback function due to the asynchronous way of chrome.Storage.local.get(). Here is my relevant code. chrome.webRequest.onBeforeRequest.addListener( function(info) { chrome.storage.local.get(

Use/productionize trained machine learning model in client-side javascript?

家住魔仙堡 提交于 2020-01-02 10:22:32
问题 So this is a slightly insane idea that I've been kicking around. I'm thinking of building a classifier for (a specialized subset of) some web content, and then supplying it to users in the form of a chrome extension. (So: user goes to web page, clicks button on chrome extension, extension applies pre-trained model to generate prediction, presents result to user.) But I'm cheap, and I don't want to run a server to receive data from the chrome extension, generate a prediction, and send it back

How to download a file via a Chrome Content Script?

好久不见. 提交于 2020-01-02 09:28:33
问题 This SO answer details how to download a file via a Chrome Extension, but I am using a Content Script, which has limited access to Chrome's APIs. In other words, I don't have access to the chrome.downloads object. I also tried this vanilla JS solution, but it did not work for me. Does anyone have a solution for Content Scripts or know why the second solution doesn't work? 回答1: Write a background page or event page and do it from there using the example in your linked answer. Communicate from

get selected/highlighted text html in gmail compose mail area

时光怂恿深爱的人放手 提交于 2020-01-02 09:21:47
问题 I am designing an chrome extension for Gmail. In this I want to get selected/highlighted text. I tried following code: if (!window.x) { x = {}; } x.Selector = {}; x.Selector.getSelected = function() { var t = ''; if($('.compose-container').getSelection){ t = $('.compose-container').getSelection(); alert(t); } else if (window.getSelection) { t = window.getSelection(); } else if (document.getSelection) { t = document.getSelection(); } else if (document.selection) { t = document.selection