I made custom chrome extension which loads external javascript file (file is hosted on amazon s3) using XMLHttpRequest. Code snippet which calls this XMLHttpRequest is in separate file, and included in manifest.json under content_scripts:
{
"background": {
"scripts": [ "background.js" ]
},
"content_scripts": [ {
"js": [ "content.js" ],
"matches": [ "http://*/*", "https://*/*" ]
} ],
"manifest_version": 2,
"name": "Name",
"short_name": "shortname",
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "1.0"
}
If I don't check inline install, it is accepted and published in few minutes.
But when I check inline install and choose site, review process takes a long time and extension becomes rejected. Domain is secured (https). And tag containing info about extension is added to site's head tag.
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID">
So, the rejection reason is probably related to inline installation method, and there should be some trick? Anyone for help? Is there something wrong I did?
Related
I got this extension for google chrome and it won't load when I try to load unpacked extension. Where is the problem?
{
"manifest_version": 2,
"name": "HTML",
"description": "HTML change",
"version": "1",
"background": {
"page": "background.html"
},
"content_scripts": [
{
"matches": ["https://ocjene.skole.hr/pocetna/prijava/*"],
}
],
}
Trailing commas mean invalid json - try this change first:
{
"manifest_version": 2,
"name": "HTML",
"description": "HTML change",
"version": "1",
"background": {
"page": "background.html"
},
"content_scripts": [
{
"matches": ["https://ocjene.skole.hr/pocetna/prijava/*"]
}
]
}
You may refer with this Can't load unpacked extension? forum.
I'm going to recommend that you start with a powerwash. This will wipe your device and return it to factory settings (and also put you back to the stable channel). Full instructions can be found in this help center article.
After the powerwash, I would suggest that you test whether or not the extension will load while still running a stable build. If it does, and then it stops working when you switch o the dev channel, that helps to narrow down the issue.
Additional references:
Load Unpacked Extension
Unable to load unpacked extensions
I'm trying to communicate from a web page to a packaged app. The idea is to have the web page read a number from a serial device. Because I want to access the serial device, I need a packaged app and can't use an extension. This is pretty similar to Keep Chrome Packaged App running in background? and it seems that Chrome documentation says this is possible.
How can I execute the chrome.runtime.sendMessage from a regular web page? When I do so, I get *Uncaught TypeError: Cannot read property 'sendMessage' of undefined. My simple function is:
function doFunction(){
chrome.runtime.sendMessage(editorExtensionId, {openUrlInEditor: url},
function(response) {
if (!response.success)
handleError(url);
});
}
My packaged app loads and can access the serial ports. But my suspicion is the manifest isn't "enabling" the chrome.runtime of the regular webpage. Manifest.json:
{
"name": "Hello World!",
"description": "My first Chrome App.",
"version": "0.1",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "16": "calculator-16.png", "128": "calculator-128.png" },
"permissions": [
"serial",
"*://localhost/*"
],
"externally_connectable": {
"matches": [
"*://localhost/*"]
}
}
Maybe it's the ://localhost/ which I'm using for testing. But Chrome does not complain.
Any ideas out there? Thanks in advance.
Xan's comment did the trick.
While Chrome did not complain about *://localhost/*, it did not work. Chrome did complain about other combinations such as file://localhost/.
I added foo.com to host file and then served up my web page through a web server, and it worked! I can communicate from my web page to my packaged app.
Note that browsing to file://www.foo.com/hostpage.html did not work. But browing to http://www.foo.com:3000/hostpage.html did. (I'm using Rails, hence the 3000 port).
Morale of the story: When testing locally, you need to add an entry with a bogus second level domain to your host file.
Here's my manifest.json:
{
"name": "RFID Tag Reader",
"description": "Reads RFID Tags connected via USB reader",
"version": "0.0.0.1",
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": {
"16": "rfid-16.png",
"128": "rfid-128.png"
},
"permissions": [
"serial",
"*://www.foo.com/*",
"*://arealsite.net/*"
],
"externally_connectable": {
"matches": [
"*://www.foo.com/*",
"*://arealsite.net/*"
]
}
}
Adding "*://localhost/*" to externally_connectable worked for me.
I'm having trouble integrating the Dropbox API with a Chrome extension. Upon trying to authenticate the Dropbox, the redirect to the Dropbox confirmation/permission page works just fine, but the redirect back to the Chrome app fails. This is the error in the console:
Denying load of chrome-extension://mlabibnomhfmephibijgghejmmmbigpi/chrome_oauth_receiver.h…sGbCG&token_type=bearer&uid=14169733&state=oas_hquvrf6k_0.ycudjb24vysexw29. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
It seems that Chrome is preventing Dropbox from redirecting back to a page within the extension. Several hours of experimenting with permissions have yielded nothing.
Here's the manifest.json:
{
"name": "MyApp",
"description": "Description",
"version": "1.0",
"icons": {"16":"icon.png",
"48":"icon.png",
"128":"icon.png"},
"manifest_version": 2,
"permissions": [
"http://*/*",
"https://*/*",
"<all_urls>",
"tabs",
"storage",
"background",
"bookmarks",
"clipboardRead",
"clipboardWrite",
"contentSettings",
"contextMenus",
"cookies",
"debugger",
"history",
"idle",
"management",
"notifications",
"pageCapture",
"topSites",
"webNavigation",
"webRequest",
"webRequestBlocking"
],
"background": {
"scripts": ["backgroundcollector.js"]
},
"browser_action": {
"default_icon": "icon.png"
},
"web_accessible_resources": [
"http://*/*",
"https://*/*",
"<all_urls>",
"chrome-extension://mlabibnomhfmephibijgghejmmmbigpi/chrome_oauth_receiver.html&response_type=token&state=oas_hquul1r4_0.1qwu7sh12pqzolxr",
"chrome-extension://*/*"
],
"content_security_policy": "script-src 'self' https://www.dropbox.com; object-src 'self'",
"key": "(included so that the extension gets a persistent extensionID)"
}
(The large number of permissions is the result of a lot of experimenting to get this to work. Obviously they'll be removed later.)
Thanks in advance!
You've got a truckload of trash in your manifest file...
To allow other web pages to redirect to a page within your extension, you have to put this file at "web_accessible_resources", without chrome-extension://.. prefix, like this:
"web_accessible_resources": [
"chrome_oauth_receiver.html"
],
You should request as few permissions as possible, see Declare permissions for a list of descriptions for each permission. I guess that you can get rid of almost every permission after reading that document.
I was working on a chromecast app, and I wanted to incorporate it into a chrome extension. I'm also using knockout.js in order to help with some of the UI. I have two pages, one is unsandboxed (http://jsfiddle.net/AuJaX/3/), and the other is sandboxed (http://jsfiddle.net/V2dJc/1/). None of the console.log's ever get called. My manifest is below:
{
"manifest_version": 2,
"name": "__MSG_app_title__",
"description": "__MSG_app_description__",
"version": "0.1",
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["js/content/content.js"]
}
],
"background": {
"scripts": ["js/back/background.js"],
"persistent": false
},
"permissions": [
"tabs",
"contextMenus"
],
"page_action": {
"default_title": "__MSG_app_title__",
"default_icon": {
"19": "images/icon-19.png"
}
},
"sandbox": {
"pages": ["sandboxed.html"]
},
"icons": { "48": "images/icon.png" },
"default_locale": "en"
}
Is there anything that I'm doing wrong, or is this something that's not supported (yet??)?
Did you whitelist the domain you are trying to use the extension on? Currently to have the Cast API injected into the page you need two things:
<html data-cast-api-enabled="true">
and you need to follow the steps at the bottom of this page (whitelisting in the extension, not the same as the Google Cast device whitelisting):
https://developers.google.com/cast/whitelisting#whitelist-chrome
That said, I doubt this is going to work. The instructions are for getting the Cast API injected into a regular web page. However, if I'm not mistaken you want the API injected into your Chrome extension page. I don't know if it will be made available there, since I don't think two different extensions are allowed to interact.
I have been developing a chrome extension locally. I just finished it and wanted to upload it to the Chrome Web Store. When I uploaded it and it told me:
An error occurred: Invalid manifest. If your manifest includes comments, please remove them as our gallery does not support them yet.
I checked the JSON to make sure it it was valid and as far as I can tell it is fully valid. I tried naming it differently and uploading it and it still didn't work. I also tried changing the encoding and that did not work. The Manifest is below
{
"name": "Name",
"version": "0.0.0.0.1",
"manifest_version": 2,
"description": "Description",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"icons": { "128": "icon.png"},
"permissions": [
"tabs",
"http://*/*",
"webNavigation",
"history",
"storage"
],
"content_scripts": [{
"matches": ["http://*/*", "https://*/*"],
"js": ["js/jquery.min.js", "js/tab.js"]
}],
"background": {
"page": "background.html"
}
}
Does any one have any clue what the problem is? It is really frustrating to get this after finally finishing the extension.
Used your manifest.json, got this error.
Could not load extension from '/Users/jjperezaguinaga/samples/ext'. Required value 'version' is missing or invalid. It must be between 1-4 dot-separated integers each between 0 and 65536.
I removed some 0's from your version and I was able to load it.
replace
"version": "0.0.0.0.1"
with
"version": "1.0"