google-chrome-extension

Close print preview window from google chrome extension project using jquery

僤鯓⒐⒋嵵緔 提交于 2019-12-13 03:46:06
问题 I am making google chrome extension project, where i need to close print preview window from my jquery code. Print preview window open automatically when i call site option from my google chrome extension project. I have also try with --disable-print-preview. in this case open print popup. so if anyone have idea to close print popup with jquery then it's also suitable for me. 回答1: [ I have found the solution to cancel the browser print preview screen. here is the solution provided in Java by

Is there any way to define own contexts for Context menu item (google chrome extension)

这一生的挚爱 提交于 2019-12-13 03:38:37
问题 I have a simple chrome extension, my goal is to hover any img or video or audio tags, get a context menu with my extension item by the rightclicking on the img, video or audio. So the problem is that when some img are inside or behind div, i can't get my context menu item because it doesn't match my contexts. The same thing sometimes happens with the video and audio. My question is there any approach to write my own context rather than using google`s "image", "video", "audio". I`ve already

Chrome extension + webview

♀尐吖头ヾ 提交于 2019-12-13 03:24:56
问题 I'm struggling to find a definitive answer to this. Chrome Apps are being deprecated across all OS except Chrome OS. <webview> is only available in Chrome Apps? This means I can't or shouldn't use <webview> in an extension (if possible)? 回答1: As per further research, testing, and comments: <webview> are definitely not useable in extensions, only in Apps. 来源: https://stackoverflow.com/questions/47274744/chrome-extension-webview

How to set current window's width, in chrome extension?

不打扰是莪最后的温柔 提交于 2019-12-13 03:23:26
问题 I'm developing a chrome extension. I tried to get the current window then set its width, but it doesn't work ? Here's the code in background.js: chrome.windows.getCurrent( {populate: false}, function(currentWindow) { currentWindow.width = 500; } ); Ans here's the manifest.json: { "name" : "windowresizer", "description" : "resize current window !", "version" : "1.0", "manifest_version" : 2, "background" : { "scripts" : ["background.js"], "persistent" : false }, "permissions" : ["tabs"] } Why

How to pass data from content script to popup.html?

烂漫一生 提交于 2019-12-13 03:19:08
问题 I'm learning how to make chrome extensions. I have a content script that will obtain some data and I want to pass them to the popup.html page to display them on the popup DOM. I've readed about the message passing in the Chrome doucumentation but I'm unable to make it work. Can anyone help me? My code: content script file: main.js (function($){ $(document).ready(function(){ console.log('Extension Started!'); var el = $(document).find('#stories_tray'); var child = el.find('._827c'); $.each

How To Execute Scripts On Background Page Of A Chrome Extension

本秂侑毒 提交于 2019-12-13 03:06:21
问题 I am developing a Chrome extention. My manifest.json is: "page_action": { "default_icon": { "19": "icons/icon19.png", "38": "icons/icon38.jpg" }, "default_popup": "options.html" }, In my extension I am trying to execute scripts which attempt to run/reach on actual web page: // in options.html chrome.tabs.executescript(null,{code:"alert('hello!');"}) ; But Chrome extension debugger outputs this error: Uncaught TypeError: Object #<Object> has no method 'executescript' I want to reflect any

Register gcm for chrome

江枫思渺然 提交于 2019-12-13 03:03:29
问题 I have a chrome Apps use push notification of GCM. I have a problem, when i don't login account on chrome. I can't receive registerId from GCM. I think a idea. When registerId empty, i show notification, request user login to chrome and show login page account on chrome. But because of security concerns , the chrome does not allow access to its setting from external links . How is open "chrome://settings/" from external links? Can register to gcm, If i don't want login account on chrome? My

Does JavaScript have the equivalent of Python's __getattribute__?

寵の児 提交于 2019-12-13 03:01:58
问题 Does JavaScript have the equivalent of Python's __getattribute__ ? In the sense that I'd like an object, a , for which a reference to a property x is equivalent to a.__get__('x') . Trying to get this to work in V8. Possible? Example: an object which makes REST-ful calls: RESTful("some-url").foo({x:1}) => response of call to "some-url/foo?x=1" 回答1: It is not possible for properties, though there is a non-standard way (__noSuchMethod__) for methods which is only available for Firefox. 来源: https

Component cannot subscribe to data source

社会主义新天地 提交于 2019-12-13 02:58:01
问题 I have this component listening for messages from a service. Note that every console.log() statement shown below is hit at least once, everything gets logged. That is, except "adding message to array" - that does not get logged, but it should get logged! Here is the component: import {Component, OnInit, Inject} from '@angular/core'; import {ChromeDataService} from '../../../../shared/services/events'; @Component({ providers: [ChromeDataService], selector: 'app-events-list', templateUrl: '.

How to paste text in <div> with chrome extension?

ε祈祈猫儿з 提交于 2019-12-13 02:56:59
问题 I would like to paste some pre-defined text to a textbox of a website using chrome extension. The target website is https://www.urlgot.com/. It is a seemly simple webpage with only one input textbox. I had found a solution to get my interesting DOM content. But how to manipulate the DOM to paste my text into the "placeholder" then? As a neophyte in chrome extension scripting, I really need some advice. The DOM of interesting is as below, <div class="form-group" id="urlFormGroup"> <input type=