How force WebExtension update on start browser? - google-chrome-extension

How force (or request in installation) WebExtension update on start browser?
In Firefox I need click in this option:
In Opera I need click in this button:
What I want to know is if there is any way to check using the API if there is any update or configure "manifest.json" to do this.
I need add autoupdate to Opera, Firefox and Chrome.
My current manifest.json (Firefox):
{
"name": "Name",
"version": "0.0.1",
"manifest_version": 2,
"description": "Description",
"applications": {
"gecko": {
"id": "xxxxxxxxx#xxxxxxxxx.org",
"strict_min_version": "45.0"
}
},
"browser_action": {
"default_icon": "images/icon.png",
"default_popup": "popup.html"
},
"background": {
"scripts": [
"background.js"
]
},
"icons": {
"128": "images/icon-128px.png",
"48": "images/icon-48px.png",
"32": "images/icon-32px.png",
"16": "images/icon.png"
}
}

For chrome extension, you could use chrome.runtime.requestUpdateCheck to request an immediate update check, and please be aware of the following important tips.
Important: Most extensions/apps should not use this method, since chrome already does automatic checks every few hours, and you can listen for the runtime.onUpdateAvailable event without needing to call requestUpdateCheck.
This method is only appropriate to call in very limited circumstances, such as if your extension/app talks to a backend service, and the backend service has determined that the client extension/app version is very far out of date and you'd like to prompt a user to update. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources.

Related

Is my manifest.json fully compliant to Manifest v3?

Recently, I have been working on a Chrome plug-in with co-workers and I must admit that I do not have much experience with Chrome extensions. We already published one version. Now, I just submitted a second release.
I am aware that following the Manifest v3 rules helps to speed up the review process. Also, I believe we are following the rules and we really need to have a fast review process.
However, I keep seeing this message:
It points to the official documentation on the topic: Migrating to Manifest v3 which includes a check-list.
This message makes me suspicious that I might have made some mistakes.
Hence, I would like to show my manifest.json:
{
"name": "My plug-in name",
"description": "Auto-fill some specific forms",
"version": "0.0.22",
"manifest_version": 3,
"action": {
"default_popup": "src/importer/popup.html",
"default_icon": "src/importer/img/company-logo.png"
},
"icons": {
"128": "src/importer/img/company-icon.png"
},
"permissions": ["activeTab", "scripting"],
"background": {
"service_worker": "src/importer/background.js"
},
"content_scripts": [
{ "js": ["src/importer/content-script.js"],
"matches": ["https://*.onewebsite.com/*"] }
]
}
It seems to be correct.
Am I missing something? Is the extension Manifest V3 compliant?
Should I ignore Chrome Web Store alert?

Chrome extension "fails" to register service worker in citrix

While developing a chrome extension and delivering to users via GPO, for some reason after the installation of the extension on chrome the service worker do not register on chrome in Citrix environment. That seems to be a problem only with Manifest V3.
Things to note:
Installation is successful on chrome, I can see the icon on chrome://extensions/, but the service worker appears "Inactive".
This particular extension is hosted on private web server.
After restarting chrome, sometimes the service worker is successfully registered.
To see if the service worker was registered, I checked on chrome://serviceworker-internals/.
What I have tried so far:
When the installation is successful, on the service worker I used this approach:
chrome.runtime.onInstalled.addListener(function (value) {
if (value.reason == 'install') {
setTimeout(function () {
chrome.runtime.reload();
console.log('Reload!');
}, 2000)
}
})
But since the service worker keeps "Inactive" and not registered on chrome://serviceworker-internals/, it didn't work.
I checked that the problem only happens in Citrix environment with non-permanent images, meaning that the extension will install in every user logon via GPO.
This extension does not have a default popup, it's supposed to work entirely on service workers, without a user interface.
I checked that with manifest V2 extensions, on the same environment, everything works fine.
If I add a popup, sometimes when the user clicks on the popup, the registration of the worker starts. Same behavior as restarting chrome.
I did not find any mention to this problem anywhere, since it's so specific.
Note: I can't share any part of the service worker since it's a private extension, but I'll share the manifest below, but keep in mind that the installation works fine as I mentioned before.
So, I'm looking for any idea on what is going on before sending an issue on chrome.
manifest.json:
{
"manifest_version": 3,
"name": "",
"description": "",
"version": "1.0",
"background": {
"service_worker": "background.js"
},
"content_scripts": [
{
"matches": [ "<all_urls>" ],
"css": [ "logic.js" ]
}
],
"permissions": [ "storage", "declarativeContent", "activeTab", "scripting", "tabs", "webNavigation", "nativeMessaging" ],
"host_permissions": [ "https://*/*" ],
"action": {
"default_icon": {
"16": "/images/logo16.png",
"32": "/images/logo32.png",
"48": "/images/logo48.png",
"128": "/images/logo128.png"
}
},
"icons": {
"16": "/images/logo16.png",
"32": "/images/logo32.png",
"48": "/images/logo48.png",
"128": "/images/logo128.png"
}
}

How to make chrome extension active permanent

im building an extension in chrome but it's always inactive if i dont open debug mode of plugin, it lead to the plugin does not working when i enter to target pages, eg: dms.mydomain-inc.com
How to make it's active permanent when i access to page registering in manifest.json?
Here is my manifest.json
{
"name": "Tool for test",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js",
"persistent": true
},
"options_page": "options.html",
"permissions": ["storage",
"activeTab",
"scripting",
"webRequest"],
"host_permissions": [
"*://*.mydomain.vn/*",
"*://dms.mydomain-inc.com/",
"wss://news.mydomain-inc.com/"
],
"content_scripts": [
{
"matches": ["*://news.mydomain-inc.com/"],
"css": ["css/style.css"],
"js": ["contentScript.js", "jquery-3.5.1.min.js"]
}
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
},
"icons": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
}
Thanks
it is normal thing developing manifest version 3 extensions.
Chrome is becoming a browser that is everything but light and this is partly due to the dozens of extensions the user installs.
Thus Google introduced service worker in extensions in order to free up some memory whenever possible.
SW is activated when necessary and then goes to sleep until the moment it's awakened to perform a new job.
Said this,
"persistent": true in manifest is useless and could generate an error.
we have to realize that when SW becomes inactive all variables and objects defined in this script will be lost unless we plan to save them somehow in a persistent storage.
Normally, the asynchronous chrome.storage API are used to save variables \ objects used in the SW.
If you cannot allow SW become inactive (for some important reason) you could use a "dirty" technique that bypasses this "restriction".
This technique consists in opening a long-lasting communication channel and sending fictitious messages between SW and any browser tab.
For more details on this technique read this thread: Persistent Service Worker in Chrome Extension

Avoid creation of browser action in Chrome extension [duplicate]

This question already has answers here:
Can I hide my extension's icon by default?
(4 answers)
Closed 5 years ago.
I am creating a chrome extension. When the extension is added to chrome, then icon next to address bar is added also (browser action). My extension does not need any browser action. So, how can I avoid creation of this icon?
Edit: My manifest file:
{
"background": {
"persistent": true,
"scripts": [ "background.js" ]
},
"description": "This extension ...",
"manifest_version": 2,
"name": "Something",
"permissions": [ "webRequest", "webRequestBlocking", "http://*/*",
"https://*/*" ],
"version": "1",
"icons": {
"128": "msdos.png"
}
If your browser extension does not need browser_action, you can simply remove it from your manifest.json see: from https://developer.chrome.com/extensions/browserAction.
It will remove the icon next to the bar address.
More details about manifest.json: https://developer.chrome.com/extensions/manifest
If it does not work, do you mind to post your manifest.json
EDIT: As wOxxOm mentionned, since January 2016, Chrome shows all the icons of the web extension. So there is no way to hide it (except on the older version of Chrome).

Why does my chrome extension ask for history permissions?

In my manifest.json file, I have nothing explicitly listed for reading a user's history, however, this warning comes up when you try to install the extension.
Here is my manifest file:
{
"manifest_version": 2,
"name": "QueueTube for YouTube!",
"short_name": "QueueTube",
"description": "Search YouTube without stopping the video, and make your own playlists!",
"version": "1.5",
"author": "Dara Javaherian",
"permissions": ["tabs", "*://*.youtube.com/*"],
"background": {
"persistent":true,
"scripts": [
"bg/socket.io.js",
"bg/background.js"
]
},
"icons": {
"128": "icons/youtube-128.png"
},
"browser_action": {
"default_icon": "icons/icon.png",
"default_popup": "popup/popup.html"
},
"web_accessible_resources": [
"spinner.gif"
],
"content_scripts" : [{
"matches" :
["https://www.youtube.com/*",
"http://www.youtube.com/*"],
"js" : [
"js/jquery.js",
"js/inject.js"],
"css" : ["styles/styles.css"]
}]
}
Does anyone know why this permission is showing up?
This is the standard warning for the "tabs" permission.
It allows you to query, and be notified of changes, to URLs of all tabs. This allows you to spy on the user's history in real time - even if you don't have access to the browser's own history log.
Note that "tabs" permission is not required in most cases. Providing access to URLs is basically the only reason to include it. You can use most of the tabs API without it, and can get access to current tab without warning using the "activeTab" permission.
Warnings and their triggers
It can be surprising when adding a permission such as "tabs" results
in the seemingly unrelated warning that the extension can access your
browsing activity. The reason for the warning is that although the
chrome.tabs API might be used only to open new tabs, it can also be
used to see the URL that's associated with every newly opened tab
(using their tabs.Tab objects)
Source: https://developer.chrome.com/extensions/permission_warnings

Resources