w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Fire extension on very page Google Chrome Extension
I would use chrome.tabs API instead of chrome.windows API. http://developer.chrome.com/extensions/tabs.html onCreated event and onUpdated event should work. chrome.tabs.onCreated.addListener(function callback) chrome.tabs.onUpdated.addListener(function callback)

Categories : Google Chrome

Chrome Extension API: chrome.tabs.captureVisibleTab on Background Page to Content Script
Use chrome.tabs.sendMessage background page: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { chrome.tabs.captureVisibleTab( null, {}, function(dataUrl) { sendResponse({imgSrc:dataUrl}); } ); //remember that captureVisibleTab() is a statement return true; } ); content script chrome.runtime.sendMessage({msg: "capture"}, function(response) { console.log(response.dataUrl); });

Categories : Javascript

how to implement Chrome extension 's chrome.tabs.sendMessage API in Firefox addon
In add-ons build using the Add-on SDK, content scripts are managed by main.js. There's no built-in way to access all of your add-on's content scripts. To send a message to all tabs, you need to manually keep track of the content scripts. One-way messages are easily implemented by the existing APIs. Callbacks are not built-in, though. My browser-action SDK library contains a module called "messaging", which implements the Chrome messaging API. In the following example, the content script and the main script use an object called "extension". This object exposes the onMessage and sendMessage methods, modelled after the Chrome extension messaging APIs. The following example adds a content script to every page on Stack Overflow, and upon click, the titles of the tabs are logged to the consol

Categories : Javascript

How do I get the the google chrome chrome.windows.create extension function to work
inline javascript codes are not allowed (by default) in chrome extensions. so you have to change the code like this. <html> <head> </head> <body> </body> <script src="loader.js"></script> loader.js: function load() { chrome.windows.create({ url: 'http://www.google.com', type: 'panel' }); } document.getElementsByTagName( 'body' )[0].onload = function() { load(); }; For more information about content-security policies visit: Content Security Policy (CSP) - Google Chrome

Categories : Google Chrome

Is there a way for a packaged hosted chrome extension to request chrome updates it?
Have you tried using chrome.runtime.requestUpdateCheck()? Your code could be something like this: chrome.runtime.requestUpdateCheck(function(status,details){}); chrome.runtime.onUpdateAvailable(function(details){ console.log('Updating to version: ' + details.version); chrome.runtime.reload(); });

Categories : Google Chrome

Chrome extension: Execute background page only once when chrome starts
What you are using is an Event Page(background_page.js). Event pages are unloaded when the browser detects that the page is not doing anything. So what's happening is that when you open a new tab, the Event page is being reloaded and starts executing from the top again. This way chrome is able to have your app use less memory and speed up the browser. If you want to fix the problem simply use persistent:true which will make sure the page "persists" indefinitely or until the user closes the browser. If you would really like to keep your app efficient with memory, you should take a look at the runtime.onSuspend method which gets called each time your Event page unloads. This way you can save stuff before the page gets unloaded so that you can resume where you left off.

Categories : Google Chrome

Porting Chrome extension to Firefox : equivalent to chrome.storage
Yes exactly, it is simple-storage. You can use it like this : const storage = require("sdk/simple-storage").storage; storage.tokenFu = token;

Categories : Javascript

a href to chrome:// url in a chrome extension how to make it work
You cannot access chrome pages from an extension. However you could get some settings with Chrome APIs Specifically Bookmarks API, Installed extensions API

Categories : Api

Difficulties saving URL from Chrome tab (for Chrome extension)
This is because when you declare your "query" variable, it only has scope within your callback function in chrome.tabs.query. Now, you could declare your variable at the top of your script to give it scope within the entire script: var query; chrome.tabs.query({'active': true}, function (tabs) { query = tabs[0].url; }); chrome.browserAction.onClicked.addListener(function(activeTab) { var stemURL = "http://www.google.com/#q=link:"; chrome.tabs.create({ url: (stemURL + query) }); }); ...or you could use your activeTab variable that chrome.browserAction.onClick passes to you and grab the active tab's URL from that to ensure that you open the search results for the tab that the user was viewing when they clicked your extension's button, which would also have the added advantage

Categories : Javascript

How to use chrome.alarms for Google Chrome extension
You didn't create any alarm, so no onAlarm event will be fired. Create an alarm with chrome.alarms.create. Note: you should do it in the chrome.runtime.onInstalled event.

Categories : Javascript

Change display information (like name) of files from a shell extension for explorer.exe
After extensive research, I've found that the best way to do it is to write a Shell Namespace extension. I'll be able to provide a virtual directory representing my server's structure, and translate the names the way I want. This seems a little overkill though, but there's no other way to change the informations displayed as the display name is managed by an IShellFolder which provides it to an IShellView One excellent source of informations I've found about it, and the most up to date so far, is an article on Michael Edenfiled's blog

Categories : C#

My chrome extension isn't synced
Chrome will only sync apps that are published to the web store. For more information on how to integrate your extension's data with sync, see this page: https://developer.chrome.com/extensions/storage.html

Categories : Google Chrome

How to run url in background of chrome extension
For Uncaught Error: JavaScript API Domain is restricted to localhost Go to your application made in linkedin and in javascript option sdk the added url is of localhost and another url there.

Categories : Javascript

Chrome Extension ContextMenu for PDF
I'm guessing that you want to add a context menu only when a PDF is shown in a tab, right? Just asking because I thought at first that you wanted to add the context menu on links to PDF files, which is indeed possible*. (as you probably know) I couldn't find a way to do this directly, however one alternative could be to listen to chrome.tabs.onActivated and add or remove your context menu based on if the current URL matches a PDF file. One drawback is that it means asking for the tabs permission which might looks scary to users. ("This extension can access your tabs and browsing activity" or something like that) *for the curious, you do it like this: chrome.contextMenus.create({ title: "Hello world", contexts: ["link"], targetUrlPatterns: ["*://*/*.pdf"] }); (you would add

Categories : Javascript

How to exit Chrome from an extension?
Install the bleeding-edge version of Chrome (get if from the dev channel or use Canary) and create an extension that uses the chrome.processes API. It seems that the browser's process has ID 0. So, the following code will terminate Chrome: chrome.processes.terminate(0); However, since this is not documented, I suggest to get a list of processes, loop through the list and terminate the browser's process: chrome.processes.getProcessInfo([], false, function(processes) { processes.forEach(function(process) { if (process.type === 'browser') { chrome.processes.terminate(process.id); } }); }); Alternative methods that work in all Chrome versions: Create a NPAPI plugin and kill Chrome. Host a local server of your choice that terminates your browser on (

Categories : Javascript

Can't upload Chrome extension
Can I comment a JSON file? You can't include comments in JSON. Raw JSON must be strictly data and contain no // comments. I pasted your code into a JSONLint validator, and as expected, it throws a hissy fit. Parse error on line 30: ...con": { //optional"19": "eye ----------------------^ Expecting 'STRING', '}'

Categories : Json

capture URL in chrome extension
Listen for the onUpdated event. chrome.tabs.onUpdated.addListener(function(integer tabId, object changeInfo, Tab tab) {...}); http://developer.chrome.com/extensions/tabs.html#event-onUpdated

Categories : Javascript

Chrome extension to dim the background
I can only assume that it looks for or elements in the page using some selector. Then it would add the div to dim the background using a content script, changing the z-index of the found video element to a higher value.

Categories : Javascript

qemu extension for Chrome
You don't need special extension to access QEMU virtual machine screen from Chrome - there are several VNC clients written in JavaScript, and QEMU supports VNC output. For example noVNC client works fine, if you don't forget to run websockets proxy. Something like qemu-system-i386 -hda /home/user/myhddimage.qcow2 -usbdevice tablet -vnc :3 & cd /home/user/noVNC ./utils/websockify --web ./ 8783 localhost:5903 & google-chrome file:///home/user/noVNC/vnc_auto.html?host=localhost&port=8783&encrypt=0&true_color=1

Categories : Google Chrome

Chrome extension callback
Add code like this in your background file: if(!localStorage.first){ chrome.tabs.create({ url : "http://whatever.com/welcome.html" }); localStorage.first = "true"; } from redirect to page.html after chrome extension installs

Categories : Javascript

Chrome Extension as GUI for JSON API
Yes, you can create your GUI in pure HTML, CSS and JavaScript. This is actually the only way to make a GUI in Chrome extensions. Your PHP based API can certainly be accessed via an extension, if designed as a fairly typical client side accessible API. Here's a brief description of Extensions and Packaged Apps: Extensions are generally designed for augmenting the browser experience. For example, analyzing the pages the user is browsing and highlighting text. Chrome exposes several awesome APIs related to the browser and the browsing experience. However, it's just JavaScript, CSS and HTML, so it's definitely possible to take it a step further and create pretty much fully functional applications. However, there are no UI specific features in the Extension API that would make it easier to c

Categories : PHP

Chrome Extension Issue
Alright, fixed when the first comment reminded me to check my chrome console. Anyway, I found the fix here: Determining where Maximum call stack size is being exceeded EDIT: New fiddle here: http://jsfiddle.net/Ultimate/TpsBv/5/ setTimeout(function() { sayHi(); }, time);

Categories : Javascript

cant' add listener in chrome extension
Eh...I just gave up and moved add button listeners logic to another place like that: document.addEventListener('DOMContentLoaded', function () { document.getElementById('loadall').addEventListener('click', loadAll) }

Categories : Javascript

Chrome extension or chrome app?
Either, or... Go with an extension if you'd like. I assume you've looked at the API reference? https://developers.google.com/google-apps/calendar/ From there, I'd imagine you'd just need OAuth to authenticate the user. Here's the JS library: https://code.google.com/p/google-api-javascript-client/

Categories : Google Chrome

Change the Chrome extension icon
Content scripts don't have access to most extension APIs. Instead, you'll need to use message passing to have the content script alert notify the background page of what works needs to be done. Your content script should send a message using chrome.runtime.sendMessage, and the background page should listen using chrome.runtime.onMessage.addListener: Content script: if(shouldChangeIcon) { // send message to background script chrome.runtime.sendMessage({ "newIconPath" : folder + icons[2] }); } Background page: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { // read `newIconPath` from request and read `tab.id` from sender chrome.browserAction.setIcon({ path: request.newIconPath, tabId: sender.tab.id

Categories : Google Chrome

How to get post data in chrome extension
I know this was asked so long ago, but in case anyone else comes across this same problem, I found the answer. You're using the listener onBeforeSendHeaders, when the only listener that supports viewing the POST data is onBeforeRequest. However, you also need to supply an extraInfoSpec of "requestBody" to the third argument of .addListener. An example is below. /* The Web Request API */ const WEB_REQUEST = chrome.webRequest; WEB_REQUEST.onBeforeRequest.addListener( function(details) { if(details.method == "POST") console.log(JSON.stringify(details)); }, {urls: ["<all_urls>"]}, ["blocking", "requestBody"] );

Categories : Javascript

Keycode not working in chrome extension
Add a parameter named event to the event handlers you assign to the events like this: window.onkeydown = function(event) { console.log(event.keyCode); };

Categories : Javascript

Chrome Extension Manifest permissions
I've just begun using ChromeExtensions, so this might not be a complete answer, but here are some issues I see: content_scripts are injected into the page and have access to the webpage's dom, but not it's JS popups live in their own sandbox and have access only to what's in that sandbox webpages cannot access JS in either the content_scripts or the popups PhotoTagger.html should be able to interact with its own JS, just by putting in a "script" tag referencing PhotoTagger.js. There are no permissions needed for that. So if your snippet is in PhotoTagger.html and there's a "script" reference to PhotoTagger.js in PhotoTagger.html, then you should be fine (and you can get rid of the whole content_scripts section). If you're doing this and it doesn't work, you might need to link more o

Categories : Javascript

add button to page with chrome extension
You can use that code in a content script set to run on specific webpages. Content scripts are JavaScript files that run in the context of web pages. By using the standard Document Object Model (DOM), they can read details of the web pages the browser visits, or make changes to them.

Categories : Google Chrome

Why is my packaged chrome extension not updating?
The issue is with self-signed certificates and Chrome. Chrome does not accept Extension updates form self-signed certificates unless they're an "accepted" authority. These steps will make it work: Follow these steps: http://stackoverflow.com/a/15076602/857025 to export your certificate and then import it as an authority Close Chrome Restart Chrome Close extensions window if opened Reopen via "chrome://extensions" and then click "update extensions now" It should then update your extension located on a self-signed https connection. UPDATE This is not a perfect solution as Chrome appears to be a bit wonky in accepting self-signed certs. It randomly stops seeing updates. If I switch back to using regular http (for the update_url and the CRX's url), updates happen every time. I checked a

Categories : Google Chrome

Chrome Extension: Handling Clicks
You can still use jquery with a chrome extension, but you need to put if out of the html my_script.js and your version of jquery to the html and then, in my_script.js: $(document).ready(function(){ // Your jquery here }); I'm not sure that the $(document).ready... is required, it depend if you put the script balises in the head or at the end of you body I hope it will helps you

Categories : Javascript

Securing the API exposed in chrome extension
No, you can not ensure that only your Chrome extension is making the requests. Once your code leaves your control (i.e. the client has it), there is no guarantee that it isn't tampered with or reverse engineered. What you can do though, is make the user log in before accessing your API. By authenticating, you aren't verifying that the user is using your Chrome extension, but you do have someone to blacklist if your server becomes the subject of large traffic. You can have the user of the chrome extension create an account one time and then the extension can send those credentials to your server with each request. You may be tempted to try things like embedding a secret token or passphrase, but this will only stop the lazy attackers. Furthermore it may give you a false sense of secu

Categories : Api

Load chrome extension programatically
You can do it by using Desiredcapabilities. DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability("chrome.switches", Arrays.asList("--load- extension=/path/to/extension/directory")); WebDriver driver = new ChromeDriver(capabilities); for detail visit here

Categories : Javascript

Detecting where a webrequest came from in Chrome extension
For anyone trying to find out how to do this: You can use the following function: http://developer.chrome.com/extensions/webNavigation.html#event-onCommitted It gives back whether a request came from the address bar.

Categories : Javascript

Chrome extension action on shutdown
This document lists an onSuspend event: Clean-up before app closes The app runtime sends the onSuspend() event to the event page before unloading it. Your event page can listen out for this event and do clean-up tasks before the app closes. Once this event is fired, the app runtime starts the process of closing the app: all events stop firing and JavaScript execution is halted. Any asynchronous operations started while handling this event are not guaranteed to complete. Keep the clean-up tasks synchronous and simple. chrome.runtime.onSuspend.addListener(function() { // Do some simple clean-up tasks. }); This document says the onSuspend is also available for extensions

Categories : Javascript

How to get window handle (int) from chrome extension?
Well, if anyone encounter the same problem, i solved it using a NPAPI Plugin in C++ that get access to win32api... In Invoke method i've checked for my method (GetProcessId) and got the parent process (since the addon is in a different process): ULONG_PTR MyAddon::GetParentProcessId() // By Napalm @ NetCore2K { ULONG_PTR pbi[6]; ULONG ulSize = 0; LONG (WINAPI *NtQueryInformationProcess)(HANDLE ProcessHandle, ULONG ProcessInformationClass, PVOID ProcessInformation, ULONG ProcessInformationLength, PULONG ReturnLength); *(FARPROC *)&NtQueryInformationProcess = GetProcAddress(LoadLibraryA("NTDLL.DLL"), "NtQueryInformationProcess"); if(NtQueryInformationProcess){ if(NtQueryInformationProcess(GetCurrentProcess(), 0, &pbi, sizeof(pbi), &ulSize) >= 0 && ul

Categories : Javascript

Chrome Extension Installation Silently
Since Chrome 25 it is no longer possible to install extensions silently. Even when installed from outside of Chrome an extension will still require a confirmation. Some resources related to this issue: http://blog.chromium.org/2012/12/no-more-silent-extension-installs.html https://code.google.com/p/chromium/issues/detail?id=172608 http://www.infoworld.com/d/applications/chrome-25-will-disable-silently-installed-extensions-209780 Having said that, if you do find a way to install an extension silently without confirmation, please report it as a bug to the chromium team :)

Categories : Google Chrome

REST Console Extension in Chrome
You have a couple other options: Chrome: Postman - REST Client Advanced REST client Firefox: RESTClient REST Easy (thanks to Nathan) See if some of them meet your needs

Categories : Google Chrome

localStorage limit in Chrome extension
Extension's localStorage is similar to website's localStorage so I guess it'd be 5mb. You can also consider using chrome.storage Extension id is the only unique thing to every extension so chrome must use this to conform to this limit.

Categories : Google Chrome

Chrome Extension notification only shows-up once?
First, you should be aware that the current notification system (i.e. webkitNotifications.createNotification) is deprecated, and has been removed from Chrome, at least on Windows and ChromeOS. See http://developer.chrome.com/extensions/desktop_notifications.html for details. Second, the notification might be null if it's closed by the user; I'd try this: function showNotify() { if (notification == null) { notification = webkitNotifications.createNotification( 'icon48.png', 'Secure page detected.', 'Checking "Enable HTTPS reading" in the setting is required.' ); } notification.show(); }

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.