I’m getting a CORS error when I try to do a request from my Chrome Extensions’s background script. The background script is bundled with webpack. Note: If I convert manifest.json to version 2 – all works fine. But with v3 it gives Access to fetch at ‘https://example.com/api/user/login’ from origin ‘chrome-extension://exampleid’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is
Tag: google-chrome-extension
Chrome Extension Opens new tab, send message to new tab
I have an App page (extension_id://app.html) I want to create a new tab: however, when I send a message to this tab id it doesnt work. here is the content.js script, but it doesn’t alert or console log Answer adding a setTimeout to call the send function works correctly, just have to have the page load and timer called perfectly,
array.splice() removes the content of an entry but not an entry itself
I am trying to remove an entry from an array using array.splice(), using this bit of code: let replaceThisArrRemoved = replaceThisArr.splice(positionNumber, 1); When I use replaceThisArr = [“apple”, “orange”, “pear”] and positionNumber = 1, it will return replaceThisArr = [“apple”, “”, pear”]. I am trying to get it to return replaceThisArr = [“apple”, “pear”] Is there any other way of
Automaticly loading script from Chrome Extension for a specyfic website
First of all, js is not my cup of tea. I’ve create a liltle chrome extension that works well, but for the moment, the script only execute when I change tab and come back on the previous tab. Here’s the code for the background.js So is there a way that when I click on the website, the script automaticly runs
Chrome extension manifest v3 Content Security Policy
I am trying to load (inject) in page a javascript code. The javascript file is local to the extension. the filepath is ‘js/somefile.js’. My web accessible resources are: The error that I get is: Answer You can resolve the inline execution error by changing scriptTag.innerHTML = scriptText; to scriptTag.src = chrome.runtime.getURL(filePath);, no need to fetch the script. Manifest v3 seems
How can I get the URL of the current tab from a Microsoft Edge extension
I’m experimenting with edge extensions , I’m trying to make one that reads the URL of the current tab, removes the string ‘%0A’ and then redirects to the cleaned URL, but I dont know how to read the current tab URL, I found how to do it in chrome: but It doesnt seem to work for Edge, I have the
Using buttons to scroll dropdown
I would like to use ‘up’ and ‘down’ buttons to scroll through options. Ultimately, the actual dropdown list will be hidden from the user. This example I have left it visible. I can’t use onclick in the button tag because this will be a Chrome Extension. The issue is the buttons don’t seem to do anything. Answer There are 2
Chrome extension with SVG icons (chrome.browserAction.setIcon)
I am using scalable SVG icons in my Chrome extension. I want to switch icons based on some parameters, so I have visual feedback. What I have realized is that when I am switching icons very quickly, Chrome is messing up and often I end up seeing the wrong icon. I added console.log prints to code to ensure I am
Chrome extension image change not persisting
I’m experimenting around with creating a Chrome extension (Opera actually but I don’t think that matters) that uses two text boxes as input to generate the path to an image to render, but the image never appears. manifest.json home.html home.js The weird thing is that when I debug my code, the correct path does appear when inspecting the element, but
How to resize chrome extension window in javascript?
I am trying to resize my chrome extensions window but I do not know how to do it. manifest.json { “name”: “Test”, “version”: “1.0”, “description”: “This extension”, “author”: “Test”, “browser_action”: { “default_popup”: “index.html”, “default_title”: “WRB” }, “manifest_version”: 2 } Answer To resize the popup window you just need to resize your content. The best way to do that is by