Hi I made a little chrome extension for my self to use and wanted to publish it so i can put it on my portfolio.When i had it locally everything worked fine but after trying to download the publish version and trying to open the popup it says
"Your file was not found It may have been moved or deleted.
ERR_FILE_NOT_FOUND"
this is my manifest
{
"manifest_version": 2,
"name": "",
"description": "",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "index.html"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"background",
"activeTab",
"storage",
"tabs",
"http://*/*",
"https://*/*"
]
}
these are my files that i compressed to upload
background.js
icon.png
index.html
main.js
manifest.json
style.css
I turned off all my other extensions to make sure it wasn't the other extension causing the problem
Related
It seems that loading external CDN scripts is prohibited in Chrome Extensions Development Manifest V3.
It's a package called 'SweetAlert2' that I'm trying to load.
However, I heard that the external JS file is not loaded due to policy, so I downloaded the sweetalert js file and defined it in manifest.json. However, in a test environment, this package works as if it were not loaded.
[manifest.json]
{
"name": "Getting Started Example",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": ["storage", "activeTab", "scripting"],
"action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["contentscript.js", "sweetalert2.all.min.js"]
}
],
"web_accessible_resources": [
{
"matches": ["<all_urls>"],
"resources": ["template.html"]
}
]
}
The contentsscript.js file is loaded fine, but I wonder if the sweetalert2 package js file is not loaded.
I'm going to make a program that inserts HTML code into a specific tag on a web page through Chrome Extension MV3.
I would like to use jquery to do the above work. However, I searched on Google and found that it did not show how to do it in the Manifest V3 environment.
How do I get jquery from Chrome Extension Manifest V3?
//manifest.json
{
"name": "test",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"permissions": ["storage", "activeTab", "scripting", "activeTab","tabs"],
"action": {
"default_popup": "popup.html"
}
}
recently I came across an error during trying to get JQuery to my chrome extension. I wrote following code and then when I try to reload my extension in Chrome browser I get the message:
Failed to load extension
Error
Could not load javascript 'jquery.js' for content script.
Could not load manifest.
The file of jquery was downloaded from their webpage (compressed production 3.5.1).
I checked several webpages connected to this problem but I couldn't find the solution.
Files in which inserting JQuery matters are below:
manifest.json
https://ideone.com/EGKlfQ
"manifest_version": 2,
"name" : "name",
"version": "1.0",
"offline_enabled": true,
"content_scripts": [
{
"matches": [
"https://www.zalando-lounge.pl/*"
],
"js": ["jquery.js","content.js"]
}
],
"background" : {
"scripts": ["background.js"]
},
"browser_action":{
"default_icon": "img/icon.png",
"default_popup": "popup.html",
"default_title": "A popup will come here"
},
"permissions": ["tabs","storage"],
"content_security_policy": "script-src 'self' https://cdnjs.cloudflare.com/; object-src 'self'"
popup.html
https://ideone.com/exMgYq
<script type="text/javascript" src="jquery.js"></script>
...other code in this file doesn't matter in this case...
I am developing a chrome extension using react which has a background script and multiple browser action js files. This is my project structure
MyExtension
|__build
|__public
| |__images
| |__scripts
| |__index.html
| |__manifest.json
|
|__src
|
|___browser action js files...
And this is my manifest.json
{
"name": "MyExtension",
"version": "0.0.1",
"manifest_version": 2,
"description": "MyExtension",
"icons": {
"16": "images/icon-16.png",
"128": "images/icon-128.png"
},
"default_locale": "en",
"background": {
"scripts": [
"scripts/background.js"
],
"persistent": false
},
"permissions": [
"background",
"notifications",
"tabs",
"storage",
"alarms",
"webNavigation",
"*://*/"
],
"browser_action": {
"default_icon": {
"16": "images/icon-16.png",
"19": "images/icon-19.png",
"38": "images/icon-38.png",
"128": "images/icon-128.png"
},
"default_title": "MyExtension",
"default_popup": "index.html"
},
"web_accessible_resources": [
"images/icon-48.png"
],
"content_security_policy": "script-src 'self' 'sha256-
5As4+3YpY62+l38PsxCEkjB1R4YtyktBtRScTJ3fyLU='; object-src 'self'"
}
I use the command npm run build for building the project where build is set to react-scripts build. Earlier, I used to debug the browser action files by inspecting the extension popup and setting breakpoints in js files under the src directory in the Source directory of the chrome developer tools window. I used to debug the background script by clicking on the background page link in the chrome://extensions page which is shown in the image below.
But recently, I notice that the browser action source files are not present under the 'Sources' tab as shown in the image below.
I just get two chunk.js files which seem to be the bundled version of all my files in the src directory. They have a lot of auto-generated code and hence I am not able to set breakpoints in the files I want.
Is there any way for me to get the individual source files to appear in the Sources tab of the Developer Tools Window?
I am new in Chrome Extension development.
I have the following permissions in manifest.json
"permissions": [
"activeTab",
"https://ajax.googleapis.com/",
"webRequest",
"webRequestBlocking",
"tabs",
"webNavigation",
"management",
"http://*/*",
"https://*/*"
]
Also background entry and background.js file
"background": {
"scripts": ["background.js"],
"persistent": true
},
This background.js is included in popup.html head
<script src="background.js"></script>
And the problem is I can't add a listener in background.js script
chrome.webRequest.onHeadersReceived.addListener
chrome.webRequest.onBeforeRequest.addListener
I get the error background.js:1 Uncaught TypeError: Cannot read property 'onBeforeRequest' of undefined.
What I am doing wrong?