Can't run scripts on gmail in chrome - javascript

I have created a chrome plugin but it is running on all google sites except gmail, how do I make it run on gmail?
My manifest file:
{
"manifest_version": 2,
"name": "drc",
"version": "0.1",
"background": {
"scripts": ["bg.js"]
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["content.js", "onclic.js", "Jquery.js"],
"css": ["drpdwn.css"]
}
],
"browser_action": {
"default_title": "Append Test Text"
},
"permissions": [
"tabs",
"activeTab",
"https://mail.google.com/*",
"http://mail.google.com/* "
]
}
Error I get is, cannot read property 'parentNode' of null

Related

why is chrome failing to load my custom extension with error "Service worker registration failed. Status code: 10"?

I am trying to load my custom extension in chrome, but I'm getting an error and the service worker is marked as "inactive"
This is my manifest file contents (removed sensitive paths):
{
"name": "Quicker",
"version": "1.0",
"description": "Automation quick actions performer",
"manifest_version": 3,
"permissions": [
"storage",
"activeTab",
"tabs",
"notifications",
"background",
"management"
],
"content_scripts": [
{
"matches": [
"..."
],
"js": [
"jquery-3.4.1.min.js",
"contentScript.js"
],
"run_at": "document_end"
},
{
"matches": [
"..."
],
"css": [
"jenkinsStyle.css"
],
"run_at": "document_end"
}
],
"action": {
"default_popup": "popup.html"
},
"background": {
"service_worker": "background.js"
},
"web_accessible_resources": [
{
"resources": [
"..."
],
"matches": [
"<all_urls>"
]
}
],
"icons": {
"128": "autoCog.png"
}
}
I've tried resetting chrome, updating, reinstalling. I've also tried to load the background file in a try/catch block and to load an empty background file all attempts yield the above state.

Chrome extension - select2 library working into console but not in content.js

Hello i'm working on a google chrome extension and workaround with https://select2.github.io .
Here is my manifest:
{
"manifest_version": 2,
"name": "Extension Test",
"description": "Test extension",
"version": "1.0",
"content_scripts": [
{
"matches": ["https://www.mywebsite.com/*"],
"js": ["jquery-1.11.3.js", "content.js"]
}
],
"background": {
"scripts": ["jquery-1.11.3.js","background.js"]
},
"permissions": [
"activeTab",
"webNavigation",
"*://*/*"
]
}
Here is what i run directly into console:
$('#myselect2').select2('open');
Then the same code into content js is not working and firing the following error:
content.js:151 Uncaught TypeError: $(...).select2 is not a function
Is it possible to open select menu from extension to content of website and if so how ?
Try Replacing with
{
"manifest_version": 2,
"name": "Extension Test",
"description": "Test extension",
"version": "1.0",
"content_scripts": [
{
"matches": ["https://www.mywebsite.com/*"],
"js": ["jquery-1.11.3.js", "content.js"]
}
],
"background": {
"scripts": ["jquery-1.11.3.js","background.js"]
},
"permissions": [
"activeTab",
"webNavigation",
"*://*/*"
]
}
you are missing a '"' in the matches property.
It looks like you are not including the select2 plugin in your extension. Download it into your extension and, in your manifest, add:
"js": ["jquery-1.11.3.js", "select2.min.js", "content.js"]

Chrome extension Web Request doesn't show info

I was looking for without success.
I want to get the status of my requests from my extension but I can not get it.
Manifiest
{
"manifest_version": 2,
"name": "Pixel Checker TT",
"description": "This extension validate your pixels and its requests",
"version": "1.6",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"background": {
"persistent": true,
"scripts": ["popup.js"]
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["sources/js/jquery-3.0.0.min.js","content.js"]
}
],
"permissions": [
"tabs",
"activeTab",
"webRequest",
"webRequestBlocking",
"*://*.mydomain.co/",
"*://*.myotherdomain.co/"
]
}
popup.js or background code
chrome.webRequest.onCompleted.addListener(function(details) {
for (var i = 0; i < details.requestHeaders.length; ++i) {
console.log(details.requestHeaders[i].url);
console.log(details.requestHeaders[i].statusCode);
}
},
{urls: ["<all_urls>"]},
['blocking','requestHeaders']);
The problem is that I dont have errors just aren not printed the info. I also tried to put the info in a div with $('#pixelsFound').text(details.requestHeaders[i].url)
but doesn't work too.

How to add user-script like tamparmonky on chrome extention

Hello i am trying to create a chrome extension. It like tampermonky. It add some user script. But the problem is some variable show undefined, But when i use the same script on tampermonky there is no error.
My extension manifest.json is
{
"name": "SayHello",
"description": "It will say hello when a page finishied load.",
"version": "0.4",
"permissions": [
"tabs",
"<all_urls>",
"storage"
],
"browser_action": {
"default_icon": "icon.png"
},
"options_page": "options.html",
"content_scripts": [
{
"exclude_globs":[],
"include_globs":["*"],
"matches": [
"http://www.amazon.com/*",
"https://www.amazon.com/*"
],
"js": ["email.js"],
"run_at": "document_end"
}
],
"converted_from_user_script": true,
"manifest_version":2
}
and email.js is.
P.when("jQuery","ready").execute(function(t){
var i="http://www.amazon.com/gp/profile/A3U7NCDBQ95EJM/customer_email";
t.get(i,function(t){
var o=t.data.email;
console.log('o:'+o);
});
return t;
});
error massage is Uncaught ReferenceError: P is not defined

How do you deal with Duplicate File names in Manifest.JSON for a chrome extension?

I am trying to implement a Github library within an extension. The file system has multiple files with the same names like "index.js" but when I look to reference these within the Manifest.json I feel like They will just throw errors
{
"manifest_version": 2,
"name": "log",
"description": "log",
"version": "1.0",
"browser_action": {
"default_icon": "favicon.png",
"default_popup": "popup.html"
},
"options_page": "options.html",
"background": {
"scripts": [ "eventPage.js", "background.js", "Gruntfile.js", "unittests.js", "crypto.js","index.js", "aes.js", "blowfish.js", "cast5.js","des.js","index.js","towfish.js", "index.js","md5.js","ripemd.js","sha.js", "armor.js", "basic.js", "index.js", "key.js", "keyring.js", "packet.js", "Signature.js", ]
},
"content_scripts": [
{
"matches": [ "<all_urls>" ],
"js": [ "Log.js" ]
}
],
"permissions" : [
"storage",
"notifications",
"contextMenus",
"http://*/*",
"https://*/*",
"tabs"
]
}
Can someone help me find documentation on how to handle file systems duplication within the Manifest.json?

Categories