Skip to content
Advertisement

Tag: google-chrome-extension

Chrome Extension – Getting CORS error when trying to fetch() from background script with manifest v3

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

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

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

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 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

Advertisement