Questions tagged [google-chrome-extension]

1

votes
0

answer
448

Views

Why am I getting “Uncaught TypeError: Cannot read property 'query' of undefined” for my chrome.tabs api extension?

I'm getting this error as I attempt to use chrome.tabs.query() It's my understanding that popup.js files, as well as background pages (but not content pages) are able to use the chrome.tabs api. With that in mind, I use the api in my popup.js file and it has worked as intended for about 2 years now....
Codarus
1

votes
1

answer
422

Views

How to send the message from popup.html to content script?

I am making an extension and want to pass the message from the popup.html to content.js but the following code alert undefined. Please give me a simple script that send message from popup.html to content.js and vice versa, further i will handle it. I want to access the DOM through this extension for...
1

votes
0

answer
252

Views

injecting html (inside extension) inside iframe using content script shows blurry

For utilising content script advantages, I tried writing html code inside my chrome extension and tried injecting it into a created iframe using content script. It actually works, however it seems blurry (I have tried --webkit-font-smoothing: antialiased - and also if I go to the direct URL of the h...
senty
1

votes
0

answer
38

Views

Chrome Extension: Storing items in content script and processing in event page

I am working on a Chrome extension that processes items on a page via the content script and processes the items in the background script. It's my understanding that the background script is useful for long processing (e.g. if I have a queue of items I need to process over time). // contentScript.j...
Julio
1

votes
0

answer
77

Views

What's the best way to store a huge array in JavaScript?

Say I wanted to create a Chrome extension that displays a random word every time it's loaded, with each random word having an equal chance of appearing. To get the random word, I would store an English dictionary as an array, generate a random number and retrieve the word at that index. My question...
Skylar Kennedy
1

votes
1

answer
183

Views

How to log out of a chrome.identity oauth2.0 token [duplicate]

This question already has an answer here: How do I log out of a chrome.identity oauth provider 6 answers I'm using Google Oauth with chrome.identity.removeCachedAuthToken(). I could sign in the user, but not sign out using removeCachedAuthToken(). chrome.identity.removeCachedAuthToken({ token: curr...
Mahendra
1

votes
2

answer
95

Views

How to delay fetch() until website has finished loading dynamic content

I have a chrome extension. Whenever the user clicks the extension's button it will download the source of the following URL: 'smmry.com/(the user's current active tab's url)' I'm using the following javascript code to download the source of the URL in the form of a html file. This code is currently...
Roymunson
1

votes
1

answer
229

Views

Get the Message Id or thread Id immediately after sent gmail

Can I get the message id or thread id immediately after sent gmail using google script or gmail API.?
user2142558
1

votes
0

answer
185

Views

How to convert Javascript array into CSV file and download it from Chrome Extension?

Hello i am new to Chrome Extension and developing it in angularjs and i am trying to convert array into csv file and download it from Chrome Extension. i have tried by var csvData = new Blob($scope.result, { type: 'text/csv' }); var csvUrl = URL.createObjectURL(csvData); chrome.downloads.download(...
Nasiruddin Saiyed
1

votes
0

answer
44

Views

Periods/ellipsis and string.replace not replacing them, any suggestions?

Not a duplicate, I've already tried the possible solutions at: How to replace all dots in a string using JavaScript I've having a JS issue with string.replace not replacing periods/ellipsis, maybe I'm just really tired but it's annoying the **** out of me. I'd appreciate any suggestions. This is in...
PlexXoniC
1

votes
0

answer
133

Views

Is it possible to make use of chrome.tts.speak() within chrome.tabs.executeScript()?

I am currently in the process of producing a chrome extension that features numerous accessibility tools, one such tool is Text To Speech. So far for every tool I have made use of chrome.tabs.executeScript(null, code{''}, however text to speech requires the use of chrome.tts.speak(). Is it possible...
Giles Goat-boy
1

votes
0

answer
42

Views

Change server IP Add-on

Is there any Add-On for Firefox or Chrome that enable modifying the server IP address without changing the hosts file? for the host specified in the URL address bar, the browser will skip DNS resolving and instead will take it from the Add-On input. is it possible to create something like this?
Maoz Zadok
1

votes
0

answer
52

Views

Passing data and event between Content, Background and Script/popup for chrome extension

I have read the documentation for Message passing between scripts but still not sure how and when to use which method. Some suggest using * chrome.runtime.sendMessage({...}) * chrome.runtime.onMessage.addListener(...) * chrome.tabs.sendMessage(tabs[0].id, { greeting: 'hello' }) I am really confused...
Pardeep Jain
1

votes
0

answer
39

Views

Chrome extension is loading the wrong icon on Chrome startup

The following manifest is supposed to load the off.png browser action icon, but when I shut Chrome down while the on.png icon is active, it loads the same on icon automatically for some reason when I start up Chrome. Is this some sort of a bug? Manifest: { 'background': { 'scripts': ['js/bg/bg.js' ]...
Nim
1

votes
1

answer
41

Views

Chrome Extension - will adding “identity” permission will cause warning on autoupdate?

I want to know if adding 'identity' permission during the next update will disable the extension (cause a warning) for current users. Documentation is silent - neither chrome.identity nor 'Permission Warnings' pages contain any info about it.
bruddha
1

votes
0

answer
27

Views

Does Google Chrome caches the content/background scripts of an extension?

I'm always wondering if the content scripts and background scripts are cached by the browser. We have a client and whenever we send him a copy of the extension for testing, it behaves differently on his part even though we are using the same version of Chrome browser.
1

votes
0

answer
59

Views

when does Windows Hosts file redirection take place

In regards to a browser http request life cycle, before the actual execution of sending the request, at what point does the, so to speak, 'DNS' of the windows hosts file take place? After entering a site address into any web browser, when you hit enter, is one of the first things that takes place a...
Descrubb
1

votes
0

answer
70

Views

Opening file Dialog with context menu

I am working to create a Web Extension for both google chrome and Firefox. Ultimately my goal is to open a file dialogue when I click on the context menu item added by my extension. However, there are two major problems when trying to do this. The file dialogue must be opened by user action that ac...
user3814158
1

votes
0

answer
52

Views

Keep chrome extension running when focus lost

I have a chrome extension that records a user's microphone when they click a button. Unfortunately, when they click anything else outside the chrome extension popup, the extension 'unmounts' and therefore microphone recording stops. This is clearly not something I want from a chrome extension that i...
Matt Hough
1

votes
0

answer
70

Views

Porting part of Selenium IDE to chrome extension

I have been trying to port Selenium IDE into a chrome extension I have been working on but to no avail. Specifically, I want to be able to execute selenium-built commands (e.g. click, assertElementVisible, etc.) in my extension. I am aware that porting Selenium into another extension has been done b...
Gary Geng
1

votes
1

answer
124

Views

How to run callback function from content script after loading page ? chrome extension

I want to run a callback function from content script after tab loading new page . Here is my code : content_script.js chrome.runtime.onMessage.addListener(function(request, sender, callback) { if (request.id == 'content_script') { // open google.com chrome.runtime.sendMessage({ 'id' : 'openUrl', '...
adam
1

votes
1

answer
279

Views

Chrome Extension: trying to use require.js in content scripts

What I'm trying to fix: I'm experiencing content.js:179 Uncaught ReferenceError: require is not defined on the line where I call var wordnet =require('../node_modules/wordnet'); And to overcome this error, I'm trying to use require.js. However, I'm not sure how to include this script in my content s...
suku22z
1

votes
1

answer
385

Views

Chrome distrusted in M70 for Aliexpress

We use to fetch product details from Aliexpress for our drop shipping store, but with the latest version of chrome V66(64bit) we see a message in console; The SSL certificate used to load resources from https://us.ynuf.alipay.com will be distrusted in M70. Once distrusted, users will be prevented fr...
sameer
1

votes
0

answer
92

Views

How can I add an extra button to the Chrome DevTools toolbar?

I have spent the better part of a day researching this, but still have no freaking clue where to even begin! Basically all I want to do is add a button to the DevTools toolbar that injects the entire DevTools window into an arbitrary page as a div or iframe, so that I can manipuate that with hover/c...
Kenny83
1

votes
0

answer
207

Views

Call function in content script from background script in chrome extension

I am trying to call a function in my content.js from background.js. How do I do this? Content.js function foo() { alert('Hi'); } Background.js main();
misterdh
1

votes
1

answer
49

Views

Chrome extension on www.google.com

While learning chrome extensions, I tried to create a simple chrome extension that has a content script with a single alert statement. This works fine when I open www.google.co.in, I get the alert but when I open www.google.com, I am not getting the alert. Screenshots attached. What am I missing? Ma...
Dhamo R
1

votes
0

answer
83

Views

Update chrome.contextMenus on right click

I am trying to change the text in the contextMenu when right clicked, but it doesnt work. Here is what I have so far. Any ideas? function getword(info,tab) { chrome.contextMenus.update('contextMenuId', { title: 'New text' }); } chrome.contextMenus.create({ 'id': 'contextMenuId', title: 'First text',...
misterdh
1

votes
1

answer
46

Views

How do you add angular script to chrome extension?

I want to manipulate the text field in a website which is written in angular, through my chrome extension, when I do so from the context of chrome console, I'm able to do edit the text field etc, however, when I do it from the code of my extension, its just not happening and throws the error that an...
Khadar111
1

votes
0

answer
29

Views

Function runs before the tab has loaded - Chrome Extension

So I am trying to find something on a new tab that I open from my chrome extension. The extension can open the tab but the Function runs before the script. I want a script or this function to run once the tab has loaded. This is my manifest.json file: { 'name': 'SwagBot', 'version': '0.0.1', 'manif...
Tyler algigi
1

votes
0

answer
33

Views

document.body in content.js returns html from popup.html not the webpage

I'm working on a profanity filter for chrome and when I use document.body to get the html from the page to apply the filter or when I use something like var webUrl = chrome.tabs.query({active: true, currentWindow: true},) I just get an undefined variable. I was wondering for any pointers where I'm...
Nate James
1

votes
0

answer
75

Views

Enable chrome extension when a tab is opened matching a url

I am pretty new to Chrome extensions and Javascript so any help will be great. Currently I have an extension that takes the currently playing song on tunein.com and populates links to search for the song on Spotify, YouTube, Google Play Music and Google. GitHub link here for reference. I'm currently...
AdamCox
1

votes
0

answer
540

Views

google chrome extension: get cookies in background.js and sendResponse to content.js

My extension adds notify to third-party websites. From this notify I should check if user is logged on our website. I want to check userId from cookies in background.js and send message to content.js. Where I need to know if cookies not empty ( chrome.cookies.get doesn't available from content.js)....
allweek
1

votes
1

answer
34

Views

Is removing permissions going to cause the extension being disabled

I used to have the v1 of the extension in the store with a set of permissions, when I published v2, I added two more permissions: A 'content_scripts' field with a 'matches' entry that matches all hosts using https://*/* A 'nativeMessaging' permission These changes in v2 caused the extension being d...
Katherine
1

votes
1

answer
72

Views

Chrome Web Store In-App Payments: Errors getting SKUs

I'm trying to get the SKUs available for a freemium Chrome Extension I'm developing. I'm following all of the documentation here: https://developer.chrome.com/webstore/payments-iap ...and I'm using the provided buy.js file, but it doesn't seem to work and the returned error messages are useless: 'I...
haberdasher
1

votes
0

answer
51

Views

How to verify that injected script has already injected into tab in chrome extension?

i am injecting various script's and css from chrome extension, below is my snippet code, Background.js function start() { var tab = JSON.parse(localStorage.getItem('tab')); chrome.tabs.insertCSS(tab.id, { file: 'assets/css/style.css' }) chrome.tabs.executeScript(tab.id, { file: 'assets/lib/jquery-1....
1

votes
0

answer
492

Views

Download file using chrome.downloads API

The extension I have made has the functionality to record the screen. At the end of recording the video has to be saved in the local machine. chrome.downloads API opens a windows toolbar to save the video file in a desired location. I want to make the download location path as well as the file name...
Vinith
1

votes
0

answer
100

Views

Include firestore library in manifest.json

So i've been working on a google chrome extension which alters HTML in a list of specific pages. What this means is that I don't have an HTML file to insert the firebase and firestore library urls into, which should then go into the manifest.json file. After having downloaded the actual library file...
1

votes
0

answer
121

Views

How to change http method using chrome.webRequest API

Am using chrome.webRequest API to modify incoming requests and responses. However, I recently encountered a scenario where am required to intercept a POST call and change it to a GET call. I tried changing the method in object that I get in the callback, but in vain. chrome.webRequest.onBeforeReque...
1

votes
1

answer
199

Views

Chrome Extension: contextMenus.create: Invalid url pattern

Trying to make a very simple Chrome extension. If someone right clicks on a subreddit link, there is a context option to send it to redditp.com instead. background.js { function redpts(info,tab) { var url = info.linkUrl; console.log('Link ' + info.selectionText + ' was clicked to be redditp'd.'); v...
Slid3r
1

votes
0

answer
37

Views

Tracking Request and Page Events in Chrome Extension

I am new to the whole chrome extension thing. I read on content scripts and background scripts and it is very confusing for my particular case. I want to track request events like OnBeforeSendHeaders up until OnCompleted, once these events fire I then want to write a flag in a place that I can acces...
Ibrahim D.

View additional questions