I'm trying to write a Chrome extension where, when clicked, it will drop down Google. For now, it only loads a local .html file. Here is the code I currently have:
{
"manifest_version": 2,
"name": "theName",
"description": "TheDesc",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png",
"default_popup": "http://www.google.com",
"default_title": "Tooltip"
},
"permissions": [
"activeTab",
"https://ajax.googleapis.com/"
]
}
I have 4 files in my folder: icon.png, manifest.json, popup.html, & popup.js. I am using the "Getting Started" tutorial from https://developer.chrome.com/extensions/getstarted as a template, as I am extremely new to all of this (vb6 programmer for years).
Edit:
I finally got it to open a webpage in the little popup. Now, I need to grab the Title of the current tab's URL, remove the spaces from it, trim it down to 30 characters max, assign it to a string, then navigate to www.website.com/STRING. What I'm thinking is the extension needs to create a new popup.html each time, but that could be taxing on the server. Perhaps this can be done straight from the extension? I don't have a clue. Just guessing at this point.
Related
I have a very simple chrome extension which basically add some text to specific pages, is working fine, but only on first loading and when i refresh the page.
The page have originally some real time filtering which update the results and the url, but because don't refresh the page, my script doesn't work.
I try to fix it using the background feature but maybe there are some simple thing i can do to force execute the script when the is some change on the page.
This is the current content of the manifest.json
{
"manifest_version": 2,
"name": "Extension name",
"version": "0.1.0",
"description": "Extension description",
"content_scripts": [
{
"js": ["contentList.js"],
"matches": ["https://www.test.com/*"]
}
]
}
I have a Chrome extension that uploads to the Chrome store just fine. My current manifest file is posted below. It is saved in ANSI format as suggested in previous posts with this issue. This is the third variant and they all produce the same error message when I try to install: "Invalid manifest". No real information. I have tried waiting 24 hours for it to propagate properly as suggested in previous posts, but to no effect.
Has anyone encountered this issue before?
The extension is here: https://chrome.google.com/webstore/detail/bamboo-dialog-fixer/oelecpkhobhmbbdmehaoonkbkdodhdio?hl=en-US
{
"manifest_version": 2,
"name": "Bamboo dialog fixer",
"version": "1.3",
"description": "This extension makes bamboo popup dialogs such a the performance dialogs fit the width of the screen.",
"icons": {"128": "BambooHR_FullSize.png"},
"content_scripts":
{
"css": "styles.css",
"matches": "https://*.bamboohr.co.uk/*"
}
}
Thanks wOxxOm. I must have screwed up, even though I thought I had it right on a previous occasion. I rewrote the file as below and uploaded and it works now.
{
"manifest_version": 2,
"name": "Bamboo dialog fixer",
"version": "1.4",
"description": "This extension makes bamboo popup dialogs such a the performance dialogs fit the width of the screen.",
"icons": {"128": "BambooHR_FullSize.png"},
"content_scripts": [
{
"css": ["styles.css"],
"matches": ["https://*.bamboohr.co.uk/*"]
}
]
}
Question: How can I redirect users to most-relevant content, sitting in 3 different sub-directories, depending on their preferred language?
What I have
I have created 3 different _locales sub-directories, each containing language-specific messages.json files:
_locales/en/messages.json
_locales/en_GB/messages.json
_locales/de/messages.json
In manifest.json in the root directory, this already works well and as expected to correctly adapt the extension's name and description in the respective language, using:
manifest.json
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.0",
"default_locale": "en",
"browser_action": {
"default_title": "__MSG_extensionName__",
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
Where I am stuck
As the user clicks on my extension's icon, I also want to load language-specific content from the most-relevant sub-directory -- instead of the "default_popup": "popup.html" line -- because some URLs that I link to from the popup.html files also differ by language:
_locales/en/popup.html
_locales/en_GB/popup.html
_locales/de/popup.html
So I thought the best way to do it is to exchange that one line from my root manifest.json that currently reads
"default_popup": "popup.html"
with a line that reads
"default_popup": "__MSG_initialContent__"
and then within each of the _locales sub-directories' messages.json files have
"initialContent": {
"message": "popup.html"
}
so that it reads the content locally from within that subdirectory.
BUT: That is where it all falls apart. Then I get a "This webpage is not found error".
I have tried, to no avail, these differing variations (examples below for _locales/de/messages.json) -- all leading to the same error message:
"initialContent": {
"message": "popup.html"
}
then
"initialContent": {
"message": "_locales/de/popup.html"
}
then
"initialContent": {
"message": "/de/popup.html"
}
and lastly
"initialContent": {
"message": "de/popup.html"
}
What am I doing wrong?
Thanks!
I know this question is very old but I just found it and I guess it would be nice for future visitors to get a solution.
What you need to achieve this are "Predefined messages"
Quote:
Predefined messages
The internationalization system provides a few predefined messages to help you localize. These include ##ui_locale, so you can detect the current UI locale, ...
[...]
The special message ##extension_id can be used in the CSS and JavaScript files, whether or not the extension or app is localized. This message doesn't work in manifest files.
The following table describes each predefined message.
##extension_id
The extension or app ID; you might use this string to construct URLs for resources inside the extension. Even unlocalized extensions can use this message.
Note: You can't use this message in a manifest file.
##ui_locale The current locale; you might use this string to construct locale-specific URLs.
[...]
I'm trying to write a simple Chrome extension. I learnt how to write the "hello world" extension that Google put out, but how do I write an extension that will actually do something? Nothing online seems to explain it well. I know it involves HTML and CSS(? ), but what do I do? Say I want to write an extension that will enlarge everything--do I write an HTML file that does this and stick it in my extension folder? And what do I write in the manifest.json file so that it actually uses the HTML file?
Also, I'm a total beginner (I don't know HTML, all I know is a bit of Java) if you couldn't tell from the basic-ness of my questions.
In order to interact with the DOM of the site the user is viewing once the extension is installed you need to use content scripts. Look at the added lines in the manifest here:
http://code.google.com/chrome/extensions/content_scripts.html
Those lines let you indicate what js and css you want to use for the site and also specify what specific domains with 'matches':
"content_scripts": [
{
"matches": ["http://www.google.com/*"],
"css": ["mystyles.css"],
"js": ["jquery.js", "myscript.js"]
}
],
Files needed:
icon.png ( http://www.mediafire.com/imageview.php?quickkey=37phkkdmd1dv1zf&thumb=4 )
manifest.json
popup.html
Put all in a folder together.
.
in the manifest.json:
{
"name": "My First Extension",
"version": "1.0",
"description": "The first extension that I made.",
"browser_action": {
"default_icon": "icon.png"
},
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
}
}
put in popup.html:
hello world
Save both files.
go to extentions ( chrome://extensions/ )
And click developer mode. http://snpr.cm/HBuhYF.jpg
Click "load unpacked extention". and locate the folder.
It should load fine.
Click on the new extention and see the glory :)
edit, just read your post - you learned a hello world /facepalm
I made an extension for google chrome but I don't like what the market put as a warning :(
This extension may have access to:
Your data on every website
Your history data
the manifest:
{
"name": "extension name",
"description": "description cool super description.",
"version": "1.0",
"permissions": [ "tabs", "http://*/*", "https://*/*" ],
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
}
}
Is there any way to explain to google that I don't access any of this? is just an app to reveal asterisk :(
If you mean "browser history" part then it's a bug on the webstore website which someone should report. This contradicts their own docs where it says that tab permission should raise "Your tabs and browsing activity" warning. (As a reference this bug report could be used)
"Your data on all websites" is correct one. Their warnings show not what you do, but what you can potentially do.