Chrome Extension manifest.json not loading permissions - javascript

I'm creating a small chrome extension to make life at work a bit easier, but I'm running into a small issue. Chrome is reading manifest.json fine with no errors but I'm not getting the requested permission.
I tried to changing the manifest.json around and reloading the extension, other fields such as the title and version updated fine, but its as if there is no permissions field in the file and chrome is telling me that the 'extension requires no special permissions'
{
"name": "Eluta Tools",
"description": "copy/paste harvesters - work smarter",
"version": "0.1",
"manifest_version": 2,
"permissions": ["activeTab", "storage"],
"browser_action": {
"default_popup": "popup.html"
}
}
I thought it was an issue with my personal machine and tried it on a different one with the same result. I had this working fine last night so I'm wondering, what mistake am I making?!?
Full code at my github

Related

How to add icon to chrome extension?

I've attempted this guide from Google, this stack post, and this stack post. I followed what I read but somehow it's not updating the icon when I see it in my extensions. Someone mentioned a dashboard, but my extension a brief script I've saved locally, and update locally when testing. This is my manifest:
{
"manifest_version": 2,
"name": "Submit Server Glory",
"version": "1.1",
"content_scripts":[
{
"matches": ["<all_urls>"],
"js": ["content.js"]
}
],
"browser_action": {
"default_title": "Submit Server Glory",
"default_icon": "money128.jpg"
},
"icons": {
"16": "money16.jpg",
"48": "money48.jpg",
"128": "money128.jpg"
},
"permissions": ["tabs"]
}
I've had this issue aswell, you might be using the new dashboard which doesn't give the option to change the extension icon. I think it may not update since its new and still in progress. If you wanted to set your icon you can opt out, edit your extension, selected extension icon, update, then opt in again to the new dashboard with your extension icon set. However, it resets whenever you push a new update which is quite annoying
It looks like PNGs work and JPEGs explicitly DON'T work, which is a strange constraint for such a popular image.

Edge extension with manifest_version:2 not works

I wanted to start to make an edge extension.
I downloaded the official samples from github.
Okaay.... I couldn't add it to edge because I got error:
"The 'manifest_version' key must be present and set to 2 (without quotes)."
I added it. But the samples are not working. I can add it to edge now, I feel I have problem with manifest or the content js script, because I tried to create an own from zero, but content.js not works. The background js run once when I add the extension. I tried to send a message from background.js to content.js, but nothing happened...
I tried to add alert to content.js, where I listen the message and I tried to add an alert here without any magic. But nothing... Edge doesn't show errors in the console.
Thanks in advance. :)
Here is the manifest:
{
"name": "Quick Print",
"version": "1.0.0.0",
"author": "Microsoft",
"manifest_version": 2,
"icons": {
"24": "icon_24.png",
"48": "icon_48.png"
},
"permissions": [
"tabs",
"https://facebook.com/*"
],
"browser_action": {
"default_icon": {
"20": "icon_20.png",
"40": "icon_40.png"
},
"default_title": "Print!"
},
"background": {
"scripts": ["background.js"],
"persistent": false
},
"content_scripts": [{
"matches": ["https://facebook.com/*"],
"js": ["content.js"]
}]
}
Perhaps you are using the latest version Microsoft Edge browser (Chromium based), but the extension is for the legacy version Microsoft Edge. In this scenario, it will show the "The 'manifest_version' key must be present and set to 2 (without quotes)" error.
To create a Microsoft Edge (Chromium) Extensions, you could check this tutorial:
Getting Started With Microsoft Edge (Chromium) Extensions
And, you could download the official simple extension sample by click the "Completed Extension Package Source for This Part" hyperlink in this link.

Chrome extension not consistently running when navigating through Twitter

I'm writing a Chrome extension for Twitter that runs fine when I load any twitter page by putting in the URL manually, or when I refresh a twitter page. However, often (though not always) it will not run when I am navigating within twitter. For example, often if I click on someone's profile, the extension doesn't run. But if I refresh the page (still on the profile page) it will run.
I feel like it might be related to this question, Chrome extension is not loading on browser navigation at YouTube, but I'm exactly sure how.
I can tell that it's not running (as opposed to not working in some other way) because I have log a bunch of stuff to the console whenever it runs.
Here is my manifest:
{
"name": "Twitter Extend",
"version": "1.0",
"description": "A sea of white space",
"permissions": ["tabs", "<all_urls>"],
"content_scripts": [
{
"matches": ["http://*.twitter.com/*", "https://*.twitter.com/*"],
"js": ["main.js"]
}
],
"manifest_version": 2
}

Content script not injected in mail.google.com/tasks/canvas recently

I'm writing a chrome extension that uses content script to make Google tasks web UI look a little better. The extension used to work fine, but it didn't work anymore starting from the recent 1~2 days.
After investigation, it seems that content script does not execute in mail.google.com domain. To verify this, I changed manifest to match all web pages:
manifest.json:
{
"manifest_version": 2,
"name": "Tasks",
"short_name": "Tasks",
"description": "Use Google Tasks in a much nicer way.",
"version": "0.0.2",
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["js/script.js"]
}
]
}
js/scipt.js
alert('Content script is alerting.');
With this change, I can see chrome pop up an alert window when I visit pages like https://www.google.com/, https://stackoverflow.com and etc, but NOT https://mail.google.com/tasks/canvas, OR https://mail.google.com/mail.
Is there anything on mail.google.com that prevents content script from executing? How can I fix this? Thanks!

chrome.storage not working

I have a google chrome app, and I tried to use the chrome.storage.sync.get, and it says, "cannot read property sync of undefined". Can someone please tell me what is going on? I have tried copying and pasting the exact line from the chrome developer website.
The code is literally:
$(".thing").click(function() {chrome.storage.sync.set(stuff)}
As far as I can tell, the mistake is just that I'm trying to use the chrome storage API in Google Chrome, not as an app.
Please follow these steps while you are using chrome.storage.sync
Declare storage permissions in your manifest.
manifest.json
{
"manifest_version": 2,
"name": "Storage",
"description": "This extension shows a Google Image search result for the current page",
"version": "1.0",
"icons":{
"256":"img/icon.png"
},
"permissions": [
"storage"
],
"app": {
"launch": {
"local_path": "options.html"
}
},
"background": {
"scripts": ["js/app/background.js"]
}
}
Reload your App in chrome://extensions so that your manifest.json gets updated in your browser.
Follow the exact syntax of chrome.storage.sync with its callback function.
Sample.js
$(".thing").click(function() {
chrome.storage.sync.set({"myKey": "testPrefs"},function(){
alert("object stored");
})
chrome.storage.sync.get("myKey",function(obj){
alert(obj.myKey);
})
});
This will work for you. I tested this code in my chrome app.
It turns out that I was trying to run this in google chrome (browser), not as a chrome app. Chrome doesn't know it should parse the code as an app, and ignores the line about chrome.storage. Something to watch out for, chrome developers!

Categories

Resources