Chrome Extension Blocked from pulling data for some users - google-chrome-extension

I've got a simple Chrome Extension that allows users to create and modify a library of comments they can add to text entry forms via the right-click menu.
It's optimized for Google Docs and commenting.
Some users are clearly blocked from pulling data from the database and I don't know why - I can't replicate.
You can use the free version to test - it should create a user on the server, then give you a right-click menu ("Annotate") that has sub-items under Argument.
Users with the problem don't see any sub-items because the values aren't pulled from the db.
The data exchange is very simple: the extension pulls a string from a php script on my server, then splits it. Here's the code that pulls the data...
Any thoughts on why some users are blocked?
chrome.storage.sync.get('userID', function (results){
if (typeof results.userID !== 'undefined') {
userID = results.userID;
var url = "http://www.11trees.com/XXXXXXXX.php?user=" + userID;
xmlhttp.open("GET", url, true);
xmlhttp.send(null);
xmlhttp.onreadystatechange = loadComplete;
} else {
chrome.windows.create({'url': "http://www.11trees.com/XXXXXXX.php"});
}
});
function loadComplete(){
if (xmlhttp.readyState == 4) {
out = xmlhttp.responseText.split("_000_");
}
}
And the Manifest (maybe I need more permissions?):
"externally_connectable": {
"matches": ["*://localhost/*.php/*"]
},
Update: one specific user with this problem tried both school and personal Google accounts, home and school internet, and multiple devices including a ChromeBook. Through screenshots she confirmed that the extension installs just fine, that she doesn't have any unusual permissions set on her Chrome account.
The 00003.log file is just empty - where there should be a small dataset, downloaded through the script, there is just no content in local storage.
Could it be antivirus that is blocking the download?
Adding full extension per Xan's request
{
"manifest_version": 2,
"name": "Annotate for Chrome",
"short_name": "Annotate",
"description": "Right-click access to a pre-written library of comments. Write it once, to perfection, and reuse forever!",
"version": "2.5.0.3",
"permissions": ["identity.email", "https://www.googleapis.com/", "clipboardWrite", "clipboardRead", "activeTab", "tabs", "contextMenus", "storage", "webNavigation", "*://*/*", "http://*/*", "https://*/*"],
"externally_connectable": {
"matches": ["http://*.11trees.com/*.php/*"]},
"oauth2": {
"client_id": "425460661917- smaehlat7c66p1ns6t90ssj3jmlrrecm.apps.googleusercontent.com",
"scopes": [
"https://www.googleapis.com/auth/chromewebstore.readonly"
]
},
"background": {"scripts": ["/scripts/background.js", "/scripts/buy.js", "/scripts/accessComments.js", "/scripts/contextMenus.js"]},
"content_scripts": [
{
"matches": ["http://*/*","https://*/*"],
"js": ["/scripts/content.js"]
}
],
"icons": {
"16": "icon.png",
"48": "icon.png",
"128": "icon.png"
},
"browser_action": {
"default_icon": {
"19": "icon.png",
"38": "icon.png"
},
"default_title": "Annotate for Google Chrome",
"default_popup": "popup.html"
}
}

Related

Get rid of "Can read and change all your data on all y.com websites" in Chrome App Extension

I'm trying to get rid of this permission requested by my app since my app technically doesn't do that. What the app does: grab event id from active tab as a variable i.e., y.com/$eventID, and button (in popup.html) that the user presses and takes them to x.com/$eventID URL.
Here is my manifest.json file:
"name": "Exit Ticket",
"version":"0.0.4",
"description": "Access your session exit tickets, right from your AV session tab.",
"permissions": [
"activeTab"
],
"icons": {
"128":"assets/synth.png",
"48":"assets/synth.png",
"16":"assets/synth.png"
},
"background":{
"service_worker": "background.js"
},
"content_scripts":[
{"matches": ["https://*y.com/*"],
"js": ["contentScript.js"]
}
],
"action": {
"default_icon": {
"16": "assets/synth.png"
},
"default_title": "Exit Ticket",
"default_popup": "popup.html"
},
"manifest_version": 3
}
My hypothesis is that the culprit is the {"matches": ["https://*y.com/*"], bit on contentscript variable. This warning appears to be making hesitant when onboarding.

Can't get access to page window object vars from chrome extension injected code, how fix? [duplicate]

This question already has answers here:
Access global js variables from js injected by a chrome extension
(1 answer)
Access variables and functions defined in page context using a content script
(6 answers)
Closed 7 months ago.
I have extension which inject code, and in injected code have func that retrieve data from window object, and when i call it from popup(calling is working) it give me error, but when i do it manually(writing the same code in console) on page, i get result. How i can get content from page where was injected my code?
Manifest v3
{
"name": "Site",
"description": "Site",
"version": "1.0",
"manifest_version": 3,
"permissions": ["declarativeContent", "browsingData", "activeTab", "scripting"],
"host_permissions": ["*://*.site.io/*"],
"content_scripts": [
{
"run_at": "document_end",
"matches": ["*://*.site.io/*"],
"js": [
"assets/js/inject.js"
]
}
],
"web_accessible_resources": [{
"resources": ["assets/js/inject.js"],
"matches": ["<all_urls>"]
}],
"externally_connectable": {
"matches": ["*://*.site.io/*"]
},
"action": {
"default_title": "Site",
"default_icon": "assets/icons/icon-32.png",
"default_popup": "popup.html"
},
"icons": {
"16": "assets/icons/icon-16.png",
"32": "assets/icons/icon-32.png",
"48": "assets/icons/icon-48.png",
"128": "assets/icons/icon-128.png"
}
}
function in injected code is
function getCSRFToken(){
return window.MYOBJECT.csrfToken ? window.MYOBJECT.csrfToken : false;
}

Chrome extension gives feedback by comparing URLs

I am making chrome extension. This is a program that checks whether a particular site is right by comparing the URL when you access Google.
The thing I want to do is compare URLs and send an alert when I connect.
However, it does not take effect until you click the chrome extension program. Please let me know the event you need.
main.js
chrome.tabs.executeScript({
code: 'document.URL;'
}, function (domain) {
var google = 'https://www.google.co.kr/';
if(domain == google){
alert('is google')
}
else
alert('not google')
})
manifest.json
{
"manifest_version": 2,
"name": "site detect",
"description": "site",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"permissions": [
"tabs"
]
}

tabs.executeScript: Cannot access contents of url

Well, this code was working and now, not anymore, WHY? I'm just trying to inject code via content script. (base code)
manifest.json
{
"name": "Test",
"permissions": [
"activeTab"
],
"background": {
"scripts": [
"background.js"
],
"persistent": false
},
"content_scripts": [{
"matches": ["http://*/*", "https://*/*"],
"js": [
"bower_components/jquery/dist/jquery.min.js",
]
}],
"browser_action": {
"default_icon": {
"19": "icon_19.png"
}
},
"manifest_version": 2
}
background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(null, {
file: "content_script.js"
});
});
I can suppose it's a permission bug. But, what should I add for this work ?
You have to add to your permissions the url of the page wich you want to inject your code.
If I well understand, you want to inject the code in the active tab, so you can use the activeTab permission that temporally give permission to your extension for the curent tab when the user invokes your extension (by clicking the browser action for example). You can read more about it here.

chrome content script onclick event

I'm trying to write a chrome extension and cannot seem to understand how to implement the following scenario:
user is on page X
user clicks on the extension's button
something happens (specifically, user is redirected to some url)
here's the manifest.json:
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png",
"default_title": "my title"
},
"content_scripts": [
{
"matches": ["http://*/*", "https://*/*"],
"js": ["myscript.js"]
}
],
"permissions": [
"tabs", "https://*/*"
]
}
and here's myscript.js:
alert('entered myscript.js..');
function doMagic()
{
alert('extension button clicked!!');
}
chrome.extension.onClicked.addListener(doMagic);
i know im missing something really obvious, but cant seem to figure it out from the docs, other sites, etc.!!
Don't use a content_script, you really only need those if have to have access to the HTML of the tab.
Use a background_page for the onClicked listener and chrome.tabs.update to redirect the page.
function doMagic(tab) {
chrome.tabs.update(tab.id, { url: 'http://www.google.com' });
}
chrome.browserAction.onClicked.addListener(doMagic);

Resources