I have looked at the Google documentation but I can't see how to change its type.
This is the error I get on loading.
There were warnings when trying to install this extension:
'browser_action' is only allowed for extensions, and this is a legacy packaged app.
This is my manifest.json.
{
"name": "first app",
"description": "this is my first app",
"version": "1.4",
"manifest_version": 2,
"content_security_policy": "script-src 'self' https://en.wiktionary.org/; object-src 'self'",
"background": {
"page": "background.html"
},
"app": {
"launch": {
"local_path": "index.html"
}
},
"browser_action": {
"default_icon": "icon.png"
},
"icons": {
"128": "icon.png",
"16": "icon.png"
},
"permissions": [
"http://*/*",
"https://*/*",
"https://en.wiktionary.org/",
"http://en.wiktionary.org/",
"tabs",
"contextMenus",
"storage",
"unlimitedStorage",
"notifications"]
}
All I have is a right-click event at any-time while browsing and store that text for viewing on a main page. I added in the "browser_action" as the chrome store isn't alowing me to upload my extension as a "legacy packaged app", but I don't really understand what that is even after reading the documentation.
For an app use a manifest that looks like:
{
// Required
"app": {
"background": {
// Optional
"scripts": ["background.js"]
}
},
"manifest_version": 2,
"name": "My App",
"version": "versionString",
...
For an extension use
{
// Required
"manifest_version": 2,
"name": "My Extension",
"version": "versionString",
// Recommended
"default_locale": "en",
"description": "A plain text description",
"icons": {...},
// Pick one (or none)
"browser_action": {...},
"page_action": {...},
...
Related
I have this very simple manifest.json:
{
"manifest_version": 2,
"name": "Sample Name",
"version": "1.0.0",
"description": "This is a sample description",
"short_name": "Short Sample Name",
"permissions": ["tabs", "https://google.com/*", "activeTab", "declarativeContent", "storage"],
"content_scripts": [
{
"matches": ["https://www.google.com/*"],
"js": [
"background.js",
"test.js"
],
"css": ["test.css"]
}
],
"browser_action": {
"default_title": "This is a sample title",
"default_popup": "popup.html",
"default_icon": {
"16": "icons/icon16.png",
"32": "icons/icon32.png"
}
}
}
When I go to url https://www.google.com/ and open the content scripts tab in Chrome's dev's tools, I do not see my test.js and test.css scripts there. And, of course, they're not working in the page.
What should I do to add them and make them work?
P.S. Of course, I've created other files, such as window.html, popup.html, background.js, and test.js and test.css too.
The extension was installed successfully, for I see it in the list of my extensions...
After realizing about the delay that comes with having a hosting permission verified, I decided to it take out. My new manifest.json is:
{
"manifest_version": 2,
"name": "Daily",
"description": "Manage your calendars smarter!",
"content_security_policy": "script-src 'self' https://ajax.googleapis.com; object-src 'self'",
"version": "0.1.0",
"icons":{
"16": "logo-16.png",
"48": "logo-48.png",
"128": "logo-128.png"
},
"browser_action": {
"default_popup": "popup.html"
},
"web_accessible_resources": [
"scripts/audio_file.wav", "reminder.html"
],
"permissions": [
"storage",
"identity.email",
"tabs",
"https://www.example.com/yzs",
"https://www.example.com/xyz"
],
"background": {
"scripts": ["jquery-3.5.1.min.js", "background.js", "flipclock-min.js", "script.js"],
"persistent": false
}
}
Yet in the developer console I am required to justify why I am using hosting permission. I tried even starting a new process hoping it wouldn't ask anymore but nothing changed. Why is this?
I am new to chrome extensions but trying to setup a XSS detector. I have the ability to test GET and POST separately so I just have GET programmed now. The extension loads but when I test from a known site the extension does nothing. Also setup a console log that gets nothing so I know the extension is just not hooked correctly. Any help on why this is not working would be much appreciated.
I have tried content_scripts in the manifest.json but then get "Uncaught TypeError: Cannot read property 'onBeforeRequest' of undefined" in the xss_detector.js
manifest.json
{
"name": "XSS Detector",
"version": "1.0",
"manifest_version": 2,
"description": "xss detector and frame buster",
"permissions": ["tabs", "notifications", "<all_urls>", "webRequest"
"webRequestBlocking"],
"background": {
"scripts": ["xss_detector.js"],
"persistent": true
},
"browser_action": {
"default_title": "Detects and Busts!",
"default_icon": "icon.png"
}
}
xss_detector.js
chrome.webRequest.onBeforeRequest.addListener(function(details) {
const start_script_re = /.*(<div>\s*)?<script>.*<\/script>
(<\/div>\s*?.*/mi;
const end_script_re = null;
if (details.method === "GET") {
console.log("http get request");
if (decodeURI(details.url).match(start_script_re)) {
return {redirectURL:"javascript:"};
}
} else if (details.method === "POST") {
}
}, {
urls: ["<all_urls>"]
}, ["blocking", "requestBody"]);
manifest.json
{
"name": "XSS Detector",
"version": "1.0",
"manifest_version": 2,
"description": "xss detector and frame buster",
"permissions": ["tabs", "notifications", "<all_urls>", "webRequest", "webRequestBlocking"],
"background": {
"scripts": ["xss_detector.js"],
"persistent": true
},
"browser_action": {
"default_title": "Detects and Busts!",
"default_icon": "icon.png"
}
}
I'm looking to create a "new tab" extension like Panda or the Product Hunt Extension: the user can open a new tab with my website inside, with an hidden url.
I've generated my package with the awesome Extensionizr and here is my manifest.json :
manifest.json
{
"name": "My app",
"version": "0.0.1",
"manifest_version": 2,
"description": "My awesome app",
"homepage_url": "http://myapp.com",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"default_locale": "en",
"background": {
"scripts": [
"src/bg/background.js"
],
"persistent": false
},
"permissions": [
"tabs",
"http://myapp.com/*"
]
}
My background.js come from this answer, the problem seems really similar.
background.js
chrome.browserAction.onClicked.addListener(function(activeTab) {
var newURL = "http://myapp.com";
chrome.tabs.create({ url: newURL });
});
I'm still getting this error when I try to run the background page from the extension settings : Uncaught TypeError: Cannot read property 'onClicked' of undefined
And when I open a new tab, Google Chrome took the advantage and display me a google search page.
I do it wrong, and I don't know how/where/why
You're completely off-track. You don't want to open a (simple) new tab, you want to replace the "New Tab page".
Daniel's answer correctly explains why your code does not work, but it won't do what you wanted.
To replace Chrome's New Tab page, you need to use Override Pages:
"chrome_url_overrides" : {
"newtab": "myPage.html"
},
Inside that myPage.html, you can add an <iframe> for your remote content.
That's because you need to register the browser action in the manifest. Here is your manifest with the browser action added at the bottom.
{
"name": "My app",
"version": "0.0.1",
"manifest_version": 2,
"description": "My awesome app",
"homepage_url": "http://myapp.com",
"icons": {
"16": "icons/icon16.png",
"48": "icons/icon48.png",
"128": "icons/icon128.png"
},
"default_locale": "en",
"background": {
"scripts": [
"src/bg/background.js"
],
"persistent": false
},
"permissions": [
"tabs",
"http://myapp.com/*"
],
"browser_action": {}
}
Here are the browser action docs: https://developer.chrome.com/extensions/browserAction
I need to know how to display a pop up window when an extension is installed.What I am trying to ask is that when I install my extension,at that moment itself, a popup window should be opened asking for a username and password.How can I do that?I am not familiar with this issue.
Here is my manifest.json
{
"name": "Calpine Extension",
"version": "1.0",
"description": "Log on to calpinemate",
"manifest_version": 2,
"browser_action": {
"default_icon": "icon_128.png"
},
"background": {
"persistent": false,
"scripts": ["background.js"]
},
"browser_action": {
"default_title": "Calpine Extension",
"default_icon": "calpine_not_logged_in.png"
},
"permissions": [
"*://blog.calpinetech.com/test/index.php",
"alarms",
"notifications"
],
"web_accessible_resources": [
"/icon_128.png"]
}
Try this:
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") { //reason ( enum of "install", "update", or "chrome_update" )
//Show the PopUp
}
});
http://developer.chrome.com/extensions/runtime.html#event-onInstalled