Menu
  • HOME
  • TAGS

Overly strict warning from Chrome Web Store for using a public API

javascript,json,google-chrome,google-chrome-extension,chrome-web-store

There is no way to do what you are asking. chrome is just informing users what your app can do. They have no way to trust you. What I suggest you do and what I have seen others do is inform potential down-loaders of the warning on your apps description...

contentScript having CORS issue with $.ajax()

javascript,jquery,ajax,google-chrome,google-chrome-extension

This is most certainly not an issue on the extension side. It clearly says that the response does NOT contain the required header. You can confirm that in the Network tab of Dev Tools. Look at your server-side code, but this question is unanswerable. Unless, of course, you are willing...

Google Chrome extension that sends a image url into a specific text field

javascript,jquery,html,google-chrome,google-chrome-extension

Your problem is caused by an extra + in your assignment to var script. Wonders of javascript: 'a' + 'b' + 'c' -> 'abc' 'a' + + 'b' + 'c' -> 'aNaNc' This is because the second expression is interpreted as 'a' + (+ 'b') + 'c', so the 'b'...

Can i embed program through native messaging in Chrome (like old npapi plugins)?

google-chrome,google-chrome-extension,npapi,chrome-native-messaging

Updated answer: So as pointed out in comments, it does obviously use native messaging; what I can't figure out is what they are doing. The project claims to be open source (and GPL) but the source is not to be found in the linked repo; the most recent commit is...

JQuery .find() failing on an .ajax() result

jquery,html,ajax,google-chrome-extension,jquery-selectors

Try something like this var $result = $('<div />').append(siteHTML); $result.find('p.description'); jQuery requires a tree structure to traverse and perform its operations. Directly trying to use .find() without having a root element would not work. In the above case $('<div/>') would be the root element and by appending the result, jquery...

Can I fire up a Chrome extension API from code?

javascript,google-chrome,google-chrome-extension

So I'm answering my own question. I've managed to get it working using externally_connectables. The externally_connectable manifest property declares which extensions, apps, and web pages can connect to your extension via runtime.connect and runtime.sendMessage. 1. Declare app/webpage in manifest.json Just declare your web-app/page within your manifest.json as an externally_connectable. E.g...

update popup.html content dynamically

javascript,google-chrome-extension,popup,google-chrome-devtools

The popup window is created/destroyed each time you open/close the popup. So sending messages to it while closed will not work. A simple solution would be to store the latest message in chrome.storage, and read the value from the popup.

How to force loading images for the webpages installed “lazy load” without scrolling?

javascript,google-chrome-extension,lazy-loading

Many of the lazy-load plugins stores the actual URL in the data-* section. When scrolling down, right before the image tag gets into view the data-* content is set on the src attribute to start loading the image. You can iterate through all the image tags like this to find...

Chrome extension console.log override

javascript,google-chrome,google-chrome-extension

The reason is because Tampermonkey injects code into a site's document, whereas in Chrome Extension no, if you do this, you edit Chrome extension's console. To do this, you should use a method to inject the script, you can see here

Using Youtube's Data API

google-chrome-extension,youtube-api,youtube-data-api

I figured it out, and here is my working code: function youtube(options, method, callback, previous, retry) { chrome.identity.getAuthToken({ interactive: true }, function(token) { fetch("https://www.googleapis.com/youtube/v3/" + options + "&access_token=" + token, { method: method }).then(function(response) { if(response.status != "204") { response.json().then(function(object) { if(object.nextPageToken) { youtube(options + "&pageToken=" + object.nextPageToken, method, callback,...

chrome extension icon is not changing

jquery,google-chrome,google-chrome-extension

setTimeout will call the function just once. I think you are looking for setInterval. setInterval(updateIcon, 300); ...

Access DOM elements data document->Iframe ->Iframe->method chrome extension

javascript,google-chrome,iframe,google-chrome-extension

This was my solution after all, between what we talk over comments and my research over docs and other threads: Content script: (function () { document.addEventListener("DOMContentLoaded", function () { contentBody = document.getElementById("contentBody"); contentBody.addEventListener("load", function () { rawContent = contentBody.contentDocument.getElementById("rawContent"); if (rawContent) { var s = document.createElement("script"); s.src = chrome.extension.getURL('injected.js'); s.onload...

How to run chrome js snippet before other js files?

javascript,google-chrome,google-chrome-extension

It's possible using Chrome Extensions. You can write an extension (how to do that is beyond the scope of the answer - see some guides in the docs) that injects a Content Script with "run_at": "document_start" configuration and match patterns that fit the pages you want to inject it to....

Background youtube player

google-chrome-extension,youtube-api

When the popup closes, the page that it contains is immediately and completely unloaded. So your iframe is destroyed. And no, you can't keep the popup open. An extension has one persistent page - the background page. You can try adding your iframe there - the sound should continue to...

can “default_popup” (in manifest.json field) have full file path?

google-chrome-extension

No. You cannot traverse up with .., or use full paths. It's always relative to the extension root. After all, when the extension is eventually packaged, it contains only files from its root (where manifest.json is) and down. I understand the desire to keep some common components in a separate...

Chrome Extension: Is it possible to create a TCP/Websocket based server on a folder?

javascript,google-chrome,tcp,google-chrome-extension

Are there any ways to create a server hosted at 127.0.0.1 which will host a folder from within a Chrome (non-legacy) Extension? No, you can't do that with an extension at all. You need a Chrome App to be able to use sockets API, and that's the only way...

How does an unpublished extension get weekly users?

google-chrome-extension,chrome-web-store

When you published your item as private that means only the trusted testers you set could see and install your extension. Besides that, the team in Google which handles the manual review and marked your item as Pending Review (maybe due some policy violation) could see and install your extension...

Opening a Chrome extension as a pop-up using a link

google-chrome-extension

Sadly, it's completely impossible. There is an API in the works, but it would require at a minimum a user gesture, at a maximum explicit invocation of the extension. So opening a link would not be enough, nor would a Native Message be....

Chome extension message between users

node.js,google-chrome-extension,google-chrome-app,p2p,chrome-gcm

No. Chrome does not give any tools to do so; any kind of interaction has to go through a 3rd-party server. GCM, for that matter, is just a routing service between clients and an app server. Extensions cannot listen for incoming connections. Chrome Apps, however, do. In that case, you...

Displaying chrome://favicon/ on newtab page

google-chrome,google-chrome-extension

I don't think it's anywhere in the docs, but accessing chrome://favicon/ needs a special permission "chrome://favicon/" in the manifest. Do note: This may change in the future. chrome://favicon is not entirely reliable. ...

chrome store extension private rsa key

google-chrome-extension,pem

No. It's sadly impossible. Besides, consider that Windows version of Chrome will refuse packaged extensions from sources other than CWS....

Host my own chrome extension in my website

google-chrome-extension

Basically, no, since Chrome 33 you can't have auto-updating extensions that are not Web Store hosted. As Teepeemm mentions, you don't have to be publicly visible on the Store catalog: you can publish as "unlisted"....

Chrome opens multiple tabs through background script but writes to console only once [closed]

javascript,google-chrome,google-chrome-extension

Your first-run.html (not listed anywhere in the question) loads the same script, causing it to open another copy (forever, or until the item in question is set in localStorage) You only get one console.log in the background script, because the code is, indeed, executed only once in the background script...

My Chrome Extension Keeps Saying Its Corrupted

google-chrome,google-chrome-extension

It because you're hitting an edge case bug in Google which verifies at run time that the contents inside an extension on disk match what was uploaded to the web store (designed to prevent malicious software from spoofing legitimate extensions). Three known such bugs are: crbug.com/437675 (dot-slash paths in content...

Chrome extension sending message from iFrame to event page then to content script

html,google-chrome,iframe,google-chrome-extension

I found a related question. http://stackoverflow.com/a/20077854/772481 From the documentation for chrome.runtime.onMessage.addListener: This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until sendResponse...

Chrome Context menu is generating incorrect link

javascript,google-chrome,url,google-chrome-extension,contextmenu

Define the protocol you want to use in your URL chrome.tabs.create({ url: "https://www.google.co.in/search?q=" + info.selectionText, }); // ^^^^^^^^ You will encounter the same behaviour on <a> if you don't define a protocol (or start the URI with // which would mean "use the same protocol as we're on now"). This...

Removing permissions of the extensions

javascript,google-chrome-extension,google-drive-sdk,access-token

In order to remove permissions I have to add another GET request to revoke permission: chrome.identity.getAuthToken({ 'interactive': true }, function(token) { // Use the token. if (token) { // Make a request to revoke token var xhr = new XMLHttpRequest(); xhr.open('GET', 'https://accounts.google.com/o/oauth2/revoke?token=' + token); xhr.send(); } chrome.identity.removeCachedAuthToken( { 'token': token...

Chrome Extension detect button inside extension

javascript,google-chrome,google-chrome-extension

A popup builds up its own DOM, so you can use var element = document.getElementById('btn') together with element.addEventListener() and chrome.tabs.query({active: true, currentWindow: true}) to get the active tab of the current window Be sure to provide tab permission in your manifest Then try this in your popup.js var b =...

Running Apps Script from Chrome extension requires authorization

google-chrome-extension,google-apps-script

...no authorization is required to edit it Fine distinction here... no PERMISSION is needed for the shared spreadsheet, however editors must still be AUTHORIZED by the service. For the Sheets UI, being logged in to your Google account is sufficient authorization. Google Apps Script kicks off the authorization cycle...

JS blocked in Google Chrome by extension [closed]

javascript,google-chrome,google-chrome-extension

Try disabling all your extensions and then re-enabling them one at a time until you find the culprit. Then you can remove or disable it.

Can I write a chrome extension to change the CSS of a page or site as the page loads?

javascript,css,google-chrome,google-chrome-extension,browser-plugin

You could either use Greasemonkey (named Tampermonkey in Chrome) to add user scripts, or if the CSS element has an unique path to identify it, you can use Stylish to overwrite CSS properties. I recommend the latter. It is easy and will certainly work....

Looking for tool that prevent script to become unresponsive [on hold]

javascript,browser,google-chrome-extension

Firefox has an option Dom.max_script_run_time. I don't know if such a thing exists in Chrome, but I wouldn't bet on it. It's probably easiest just to run this script in FF. http://kb.mozillazine.org/Dom.max_script_run_time...

How to select Chrome extensions to enable when using Selenium [duplicate]

python,selenium,google-chrome-extension,webdriver,web-testing

You can accomplish this using ChromeOptions class or DesiredCapabilities. For that you have to have the .crx file and load that with driver instance. import os from selenium import webdriver from selenium.webdriver.chrome.options import Options executable_path = "path_to_webdriver" os.environ["webdriver.chrome.driver"] = executable_path chrome_options = Options() chrome_options.add_extension('path_to_extension') driver = webdriver.Chrome(executable_path=executable_path, chrome_options=chrome_options) driver.get("http://stackoverflow.com")...

Popup-script in chrome extension sends messages several times

javascript,google-chrome-extension,content-script

From https://developer.chrome.com/extensions/tabs#method-sendMessage: Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The runtime.onMessage event is fired in each content script running in the specified tab for the current extension. This means that if there is...

Chrome extension, custom context menu item not showing [duplicate]

google-chrome-extension

I carefully read several sample extensions' source code. Since I set "persistent" to false, the extension is running with Event Page. Thus my code works by removing onclick from the parameter object of chrome.contextMenus.create: chrome.contextMenus.create({ "id": "qwertyuiop", "title": "Click Me", "contexts": ["page", "selection", "image", "link"] }); Here's a note from...

Chrome extension: Getting html of page before page renders/loads

javascript,jquery,html,google-chrome-extension

Use run_at: "document_start" with DOMContentLoaded event listener (or MutationObserver if you want to process the document while it's loading) in your content script.

How to make function in loop run synchronously?

javascript,jquery,loops,google-chrome-extension,synchronization

One option would be to make your function(response) recursive. When it runs, call this same method again. Pass in some of your "looping" variables, and just do an if check at the beginning. function AnotherGoRound(i,data) { if (i<data[i2].data.length) { console.log("SENDING: i=" + i + "; i2=" + i2); // Send...

chrome extensions Uncaught ReferenceError: $ is not defined

javascript,jquery,google-chrome,google-chrome-extension

First Load Jquery Plugin after you can load your popup.js <script src='./js/jquery.min.js'></script> <script src="popup.js"></script> Note: No need to load 2 jquery Plugin...

Can Chrome extension content script access all tabs?

google-chrome,google-chrome-extension,content-script

According to https://developer.chrome.com/extensions/content_scripts , a content script cannot access chrome.* APIs, except a few allowed ones but chrome.tabs is not among them Exchanging messages with the parent script is possible, though, so this might be the way to do it. See https://developer.chrome.com/extensions/messaging...

chrome.extension.getBackgroundPage is undefined in an extension page in an iframe

javascript,google-chrome,google-chrome-extension

Most extension APIs can only be used if the page runs in the extension process, i.e. the top-level frame is a non-sandboxed chrome-extension: page. chrome-extension:-frames in a non-extension process can only access the extension APIs available to content scripts and web pages. And unlike content scripts, they can also use...

Chrome extension options

javascript,google-chrome,google-chrome-extension,options

the new "chrome_style" options actually don't show anything logged to the console trough console.log, your script is probably fine, try adding something to the dom. Add this at the beginning of your script to see any errors happening in your chrome options page: var errorText = document.createElement("div"); document.body.appendChild(errorText) window.onerror =...

can't submit form in chrome extension

javascript,html,html5,google-chrome,google-chrome-extension

There isn't way in client side to do security login! The easiest way in javascript to store a data is localStorage. The safest way is indexedDB because the user cann't easily change and delete the data - but he can! There isn't a speciel way in chrome-extension to do this....

How to get chrome extension ID in dev and production?

google-chrome-extension

Find it in the webstore developer dashboard. Click the more info button. Copy the "Public key". Add a "key" item to manifest.json. Paste the string value to key. Like this: "key": "yourPublicKey"

Programmatically upload a file from chrome extension. How to?

google-chrome,google-chrome-extension

Use HTTP PUT or POST, the same way you would upload from a web app. From Javascript, you do this with XMLHttpRequest(), specifying 'PUT' or 'POST' as the first argument to the open() method (whatever your server requires). MDN has this example (as they note, sendAsBinary() in the example should...

How to use external ajax response in Chrome Plugin

javascript,jquery,ajax,google-chrome-extension

Problem Chrome content scripts and the page's own scripts live in isolated worlds. Content scripts execute in a special environment called an isolated world. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. Your...

chrome extension cannot send message after extension reload

javascript,google-chrome,google-chrome-extension

you arent missing anything. this is how it currently works. i dont like it either. this is very common because it happens when chrome auto updates an extension, even while in use. i deal with this in my extension by detecting that specific error you mention. each content page then...

I added a new chrome extension but the icon not appearing on right of address bar.

google-chrome,google-chrome-extension,icons

Peerio is an app, not an extension. Therefore, it cannot even have a button there. You can access it though chrome://apps or the "Apps" launcher on the New Tab page....

management permissions for chrome extension in content script

google-chrome-extension

Something possible is that your content script ask the background script for getting the list of apps installed. Put it in your content script. chrome.runtime.sendMessage({messageName: 'getAllApps'}, function(apps) { // do what you want in with the apps list }); and in your background script listen the request and return the...

Chrome Extension - How to execute a JS script on page load

javascript,google-chrome,google-chrome-extension,google-chrome-devtools

I presume you have no problem getting a content script to run once on page load. I'm not going to help you with that... You're going to have to have the content script send a message to the background script use chrome.alarms.create(string name, object alarmInfo) in the background script listen...

“OAuth2 not granted or revoked” when trying to evalutate free trial in Chrome extension

google-chrome,google-chrome-extension,oauth-2.0

Code-wise, the only change needed is to enable interactive mode: chrome.identity.getAuthToken({ 'interactive': true }, function(token) { ... }); There were also a couple of PEBCAK issues going on. Namely: It can take a few seconds for the interactive auth page to appear. This seems to be a bandwidth issue. This...

Chrome identity launchWebAuthFlow only opens empty callback page

javascript,google-chrome-extension,callback,oauth-2.0,identity

You are misunderstanding the identity API. You cannot use it with a custom callback URL. The API expects you to use a URL of the form https://<app-id>.chromiumapp.org/* which you can obtain with a call to chrome.identity.getRedirectURL(path) When the provider redirects to a URL matching the pattern https://<app-id>.chromiumapp.org/*, the window will...

Simple Chrome Extension : Open an url in a new tab

google-chrome-extension

You're completely off-track. You don't want to open a (simple) new tab, you want to replace the "New Tab page". Daniel's answer correctly explains why your code does not work, but it won't do what you wanted. To replace Chrome's New Tab page, you need to use Override Pages: "chrome_url_overrides"...

Why does chrome.tabs.create create 2 tabs?

google-chrome-extension

The issue is that there are 2 "background" pages running. The official background page specified in the manifest file. The tab created by chrome.tabs.create({'url': chrome.extension.getURL('background.html')}). This means there are 2 message listeners, which is why 2 tabs are opening. The console messages from the official manifest.json background can be found...

“Referer” header is missing when user clicks on a link from inside an iframe that overrides a newtab in Chrome

iframe,google-chrome-extension,http-headers,http-referer

"eroman at chromium.org" nails it down (see linked chromium bug report, already closed). The thing is, when iframe contains a secured (https) page, but iframe itself is contained in a non-secured page (replaced Chrome newtab, in this case), then a non-secured (http) request is made when user click on a...

Request with google chrome api

google-chrome,google-chrome-extension,google-chrome-app

If your problem is sharing storage with your content script, you should look into chrome.storage API. It's a storage area that is accessible both to your background and content scripts. The transition from localStorage is not painless though, since the API is asynchronous. As for messaging, well, use Messaging. The...

Passing a response callback via promise between background and content script? [duplicate]

javascript,google-chrome-extension

Nevermind...you don't even need to call a background script, since chrome.extension.getURL is accessible to the content script. So you can just do this: contentsript.js getTemplate('templates/template.html') .then(function(html) { var el = $(html); $('body').append(el); }); function getTemplate(url) { return new Promise(function(resolve, reject) { $.ajax({ type: "GET", url: chrome.extension.getURL(url), success: resolve }); }...

How to find a dynamically added array element in a function

javascript,jquery,html,arrays,google-chrome-extension

I got your code to work with four changes: (1) The biggest change was to rewrite the saveNote() function so it does not call addNote() until the chrome.storage.local.set function's callback is called. This change is needed because the chrome.local.storage functions are asynchronous. function saveNote() { var noteTitleContent = document.getElementById("note-title").value; var...

Optional permission for filesystem

google-chrome,google-chrome-extension,google-chrome-app

You should request the fileSystem.directory permission as well if you want to use chooseEntry with type openDirectory. This can be done as follows: chrome.permissions.request({ permissions: [ 'fileSystem', 'fileSystem.write', 'fileSystem.retainEntries', 'fileSystem.directory' ] }, function(granted) { if (granted) { /* use chrome.fileSystem API */ } }); Before Chrome 45, there was...

What is the use of different OnBeforeRequestOptions and OnHeadersReceivedOptions?

google-chrome-extension,options,webrequest

You can have read-only access to request body if you wish. Same with request headers, and if you have blocking enabled as well you can modify them. Passing those to your listener is an expensive operation, and that's why it's not on by default. You should not add them unless...

How to tell if a page is loaded as a popup or in a separate tab in chrome extension

google-chrome,google-chrome-extension

Use chrome.extension.getViews, which returns an array of window objects. var tabs = chrome.extension.getViews({ type: "tab"}) if(tabs[0]) { console.log("inside tab") } var popups = chrome.extension.getViews({ type: "popup"}) if(popups[0]) { console.log("inside popup") } Or chrome.tabs.getCurrent, which returns a tab object in the callback. chrome.tabs.getCurrent(function(tab) { if(tab) { console.log("inside tab") } else {...

Composing email(gmail) from chrome extension

javascript,email,google-chrome-extension

Try this link - https://mail.google.com/mail/?view=cm&fs=1&[email protected]&su=SUBJECT&body=BODY&[email protected] This is the gmail link to compose an email. Is this what you where looking for?...

What is the easy way of installing chrome app from folder, for development, after loading will be disallowed?

google-chrome,google-chrome-extension

It seems I misunderstood the news. Installing through "Load unpacked extension" will still be possible, as explained here https://www.chromium.org/developers/extensions-deployment-faq#TOC-Will-this-affect-my-ability-to-develop-my-extensions-on-Windows-...

Is there a way to launch chrome packaged app from chrome extension

google-chrome,google-chrome-extension,google-chrome-app

There are 2 possible reasons for not being able to use chrome.management. You have not reloaded your extension properly You are trying to call this from a content script; you can't do that, since a content script has very restricted access to Chrome API. You need to message a background...

Script tags don't work in Chrome Dev Editor

javascript,google-chrome-extension,chrome-dev-editor

Chrome doesn't allow javascript in extensions like that. The code has to be in a separate .js file for it to work as an extension. Just swap your code for this: <script src="otherfile.js"></script> Then put the javascript in otherfile.js...

What is “platforms” for in manifest.json?

google-chrome-extension,google-chrome-app

The platforms key in the manifest file is part of a feature called multi-platform zip files, which is only relevant for NaCl. Developers can reduce the size of the crx file by putting platform-specific files in the _platform_specific directory and listing the directories in the platforms key in manifest.json. Users...

Cross-Domain OAuth… how to get response?

javascript,google-chrome-extension,oauth,cors

How about the following: In the final stage of the auth flow you can redirect to server.com you since you own server.com you can inject a script at the end that passes data to the extension via window.opener.postMessage For example, in the final page rendered by server.com: window.opener.postMessage({"userhash": "abc1234567890"}, '*');...

Chrome Extension Script not Working

javascript,html,google-chrome-extension

You can't put javascript code in html file in goolge-chrome-extension. replace html <body onload="init()"> with: js document.body.addEventListener('load', function () {...}) For more information, see contentSecurityPolicy....

jQuery not working in background.js of chrome extension

javascript,jquery,google-chrome,google-chrome-extension

The content_scripts property is intended to link scripts and stylesheets that will be inject in the context of webpage where your extension will be active. if you want to use the jQuery in the background page, you should add the jquery.min.js to the scripts property of the background: "background": {...

Chrome Extension : How to intercept requested urls? [closed]

google-chrome,http,google-chrome-extension

JavaScript Code : The following example illustrates how to block all requests to www.evil.com: chrome.webRequest.onBeforeRequest.addListener( function(details) { return {cancel: details.url.indexOf("://www.evil.com/") != -1}; }, {urls: ["<all_urls>"]}, ["blocking"]); The following example achieves the same goal in a more efficient way because requests that are not targeted to www.evil.com do not need to...

What is the name of the language in which the main program of Chromium is written?

google-chrome-extension

Chromium is written in C++11. You can view the source on https://chromium.googlecode.com which includes a C++11 Style Guide: Chromium C++11 Style Guide in Git Chromium C++11 Style Guide in HTML ...

Chrome extension add iframe and access parent window content

angularjs,iframe,google-chrome-extension

You can't do it directly; cross-origin restrictions apply. Instead, you need to message your content script to manipulate/query the page for you....

How to access the DevTools API without actually opening the DevTools window?

google-chrome-extension,google-chrome-devtools

The chrome.devtools API cannot be used without opening the devtools window. The Facebook Pixel Helper uses the chrome.webRequest API to get information about network requests. This API does not offer any access to the response body, so that's not particularly helpful. There are some more (powerful) methods, which are not...

IndexedDB: Can you manually initiate a version change transaction?

javascript,html,javascript-events,google-chrome-extension,indexeddb

You are getting InvalidStateError because you may not be calling IDBDatabase.createObjectStore() from onupgradeneeded event handler. In case of IDB, all object store creation and manipulation has to happen from inside of onupgradeneeded event handler or after onupgradeneeded is triggered. If I understood your requirement correctly then you do not want...

Is it possible to use (or include) node.js framework in a Google Chrome Extension?

javascript,node.js,google-chrome,google-chrome-extension,socket.io

For a chat application you would need a server, which should not be in the browser. Chat clients may be built using the current HTML + CSS + JS extensions API, you do not need Node.JS for creating them. Yes, you can use Socket.io with the Google Chrome extensions, you...

Make an animated Chrome extension icon?

javascript,google-chrome,google-chrome-extension,icons,animated

A few changes should be done: Checking if current > max should be moved inside the function console.clear(); var min = 1; var max = 12; var current = min; var keep_switching_icon = true; function rotateIcon() { if (keep_switching_icon) { //chrome.browserAction.setIcon({path:"icon" + current + ".png"}); console.log(current); if (current++ > max)...

background to content script messaging: message sent before content script is ready

javascript,google-chrome,google-chrome-extension,messaging

The safest way is to send a message from the content script indicating that it is ready, and only then reply from the background page. You can, for instance, add something like a queue per tab ID and push messages there, and when the message from that tab arrives feed...

Jquery auto popup with google chrome extension install check

javascript,jquery,css,google-chrome,google-chrome-extension

You need a number of things to accomplish this, and you'll probably have to work through the code yourself, but to get you on a path: Check if browser is chrome: JavaScript: How to find out if the user browser is Chrome? Check if your chrome extension is installed: This...

Meta tags in chrome extension manifest.json?

google-chrome-extension

I don't think meta tags are supported, but if you place the keyword in the description field, then that seems to work. For example: { "name": "Brad's animal name extension", "description": "Lets you name animals like Elephant and Rhino", ... } ...

Is there a way to view chrome.storage.local in Developer Tools?

google-chrome,google-chrome-extension,google-chrome-devtools

You can use this extension: https://chrome.google.com/webstore/detail/ocfjjjjhkpapocigimmppepjgfdecjkb Here are the docs for extending Devtools: https://developer.chrome.com/extensions/devtools...

How to set the badge text in a chrome extension from the content script?

google-chrome-extension,content-script

No, it's not possible. You need to message a background page to do it for you. However, content scripts have some limitations. They cannot: Use chrome.* APIs, with the exception of: extension ( getURL , inIncognitoContext , lastError , onRequest , sendRequest ) i18n runtime ( connect , getManifest ,...

Set chrome extension cookie value name as var

javascript,google-chrome,google-chrome-extension

You're using it wrong. It should be: chrome.cookies.set({ url: "https://www.someurl.com/", name: someName, value: someValue }); So you can set both as variables. However, in a general case (say, chrome.storage API that really takes name-value maps), you could do the following: var data = {}; data[name] = value; // Both are...

when chrome extension gets updated does the data stored in local storage gets deleted?

google-chrome,google-chrome-extension

If you have it in 'Chrome Web Store' and you update the extension is not removed. However if you use 'Load Extension Unpacked' or 'Reload Extension' is removed

This extension doesn't work for me?

javascript,json,google-chrome,google-chrome-extension

i think you have to use the content script permission like "content_scripts": [ { "matches": ["http://www.google.co.in/*", "https://www.google.co.in/*"], "js": ["myscript.js"] } ] } and not background see https://developer.chrome.com/extensions/content_scripts...

Chrome Extension Cannot Read Property create of undefined in contextMenus.create

javascript,google-chrome-extension

You cannot use most chrome apis in content scripts. Instead, create a background page and create the context menu there when it receives a message from the content script. When the background page receives the click event, send a message to the content script. https://developer.chrome.com/extensions/messaging...

Constantly check the length of an element and perform an action if it is ever 1

javascript,jquery,events,javascript-events,google-chrome-extension

You can use a mutation observer on a parent/ancestor node instead, watching for changes to the subtree and/or childList. var ancestor = $("...closest ancestor that doesn't change..."); // Worst case, $('body') var ob = new MutationObserver(function() { if($('.username_field').length == 1){ loginUser(); } }); ob.observe(ancestor[0], { subtree: true, // You probably...

Event for Chrome Google account logout or Google account user switch

javascript,google-chrome-extension,oauth-2.0,google-account

"Fired when signin state changes for an account on the user's profile." https://developer.chrome.com/extensions/identity#event-onSignInChanged...

Run a function from injected js

google-chrome-extension

I presume that the issue is all about the context. You're right about it. The file "temp-file.js" has been injected into host page, so it is now part of host page context. Extension can mess with it - since it is in different context. Run a function from injected...

chrome.runtime.onInstalled is undefined

javascript,google-chrome,google-chrome-extension

You are, for some reason, trying to use the same script as a background script and a content script. Never do that, as it's just confusing, and for the reason below. I bet you see this error in the content script. Content scripts have very, very limited access to Chrome...

Using openweathermap api for free

google-chrome-extension

Check out http://openweathermap.org/price_detailes for more details. All data provided by OpenWeatherMap is distributed under terms of the Creative Commons license http://creativecommons.org/licenses/by-sa/2.0/. Under this license data can be freely used through API with non-commercial or commercial purposes. However, the OpenWeatherMap name must be mentioned as a weather source in a visible...

Are there any Chrome-specific techniques to scope/isolate CSS?

css,google-chrome,google-chrome-extension,polymer,shadow-dom

What you will want to look into is shadow-dom. This will enable you to create a widget/component (which would be your injected html). This would mean that the DOM tree for the widget/component is encapsulated and no external styles from the page will affect it. There is a good article...

Chrome developer sidebar in extension pane

google-chrome,google-chrome-extension,google-chrome-devtools

By hand. If you're crating a whole panel, it's an HTML document under your full control. But as a result, there is no "standard" framework embedded in your HTML that would allow for standard methods....

Is there any way to detect javascript postmessages using chrome extension?

google-chrome-extension,postmessage

Run a content script and bind a message event listener. This event listener will then be invoked postMessage is called.

detect requests calls in a url similar to network in chrome dev tools

javascript,google-chrome,google-chrome-extension,google-chrome-devtools

I could do it using webRequest in chrome extension. I added this code in the background.js and it worked. chrome.webRequest.onCompleted.addListener(function(details) { var extension = details.url.split('.').pop(); if(extension == 'm3u8' ){ console.debug(details.url); } }, { urls: ["<all_urls>"] }); ...