I want to upgrade all my extensions to version 2 but still remain backward compatible for people that still have an older versions of chrome installed.
Since multiple manifest versions are currently unsupported, I would like to know which is the lowest version of Chrome that will support "manifest_version": 2 and its properties.
Manifest v2 was introduced in Chrome 18. Using Manifest version 2 adds several requirements to a extension, the most significant being:
The default Content Security Policy which disallows external JavaScript files to be loaded via <script> tags in extension's context, and which disallowes execution of JavaScript code which are created via a string: Inline event listeners, inline scripts, eval, etc.
A consequence of broken features are JSONP and eval-based templating engines. These can be solved by using ordinary cross-site AJAX respectively the sandbox Chrome 21+.
The web_accessible_resources field is initiated at an empty list and hence all resources are blacklisted by default.
The "background_page" manifest entry becomes unavailable (superseded by "background" + "scripts" or "page").
Manifest 2 also allows some APIs to be used, for example the chrome.storage API. When manifest v2 is left out, this message will appear below your extension.
Except for the last remark, all of these requirements result in a stricter coding guideline for Chrome extensions (compared to manifest v1).
Any code which complies with the CSP is also working in manifest v1.
All of the extension's sources are whitelisted, thus accessible to ordinary web pages.
"background": {"scripts": ["..."]} (and "page") is backwards-incompatible with Chrome 17 and lower, because it's introduced in Chrome 18. Use "background_page": "background.html" instead.
One extension for all Chrome versions can only be used if you're not using a background page. In other cases, such a hybrid (manifest v1+v2 compatible) extension cannot be achieved.
If you intend to distribute two different extensions, set "minimum_chrome_version": "18" in your manifest file. Don't forget to mention the location of the extension for older browsers.
Related
I need to develop some sort of browser plugin/extension to track search string on some search engine web site, ex: google.com, bing.com.
From the research, for chrome extension, I saw somebody suggest content js is the way to go. Is it true? Is there a cross-browser approach?
You can use Content.JS or any other JS library you like for developing an extension but with only JS library you cannot develop an extension.
There is a specific way for each browser. It contains at least 4 files.
(1) Manifest file (2) HTML file (3) JS file (4) CSS file
You also need to refer browsers object model.
You can refer links below may help you to get more information.
(1) Creating a Microsoft Edge extension
(2) Getting Started Tutorial to create an extension for Chrome
(3) Your first extension for FireFox
To support cross browser functionality, You can try to port your chrome extension to Firefox or MS Edge. To get more information on porting an extension, you can refer links below.
(1) Porting an extension from Chrome to Microsoft Edge
(2) Porting a Google Chrome extension
Note:- You also need to refer policy of each browser to access browsing data of users. It can be possible that all browser has some difference in their policies.
Is it possible to set both chrome themes and chrome defaults (i.e. Default Homepage and Search engine) in single chrome extension?
No, since Themes are separate from Extensions (that have the functionality to override settings) - it cannot be one entity. As soon as you declare "theme" in the manifest, you can't add normal Extension keys.
An extension cannot cause other extensions (including themes) to be installed. I have briefly thought of using Shared Modules mechanism, but that doesn't allow the imported extension to operate normally - so an imported theme (if that was even possible, which I doubt) wouldn't work.
Additionally, there is no extension API to manipulate themes, and no setting override to configure a theme.
I have a NPAPI plugin , running fine in firefox. Now i want to port it to chrome browser, means i want it to work in chrome also.
But i have learnt after browsing on internet and many links that chrome no longer supports NPAPI rather now it supports pepper API and now there is concept of native client.
What i have developed an understanding so far is that if i replace the NPAPI code(made for plugin for firefox) with the Pepper API code and upon compilation, a pexe file(native client module) along with manifest file(which is referring to the location of the pexe file) would be generated which would be kept on the server.
when an html page having embed tag describing a particular MIME type, say "application/x-pnacl" is loaded, then via src attribute(referring to the manifest file) of embed tag, manifest file is fetched which then fetches the actual pexe file which is then run by/within the native client plugin(already present in chrome).
I am not sure whether this understanding is correct or not. I was assuming that just like firefox plugin, pexe file would be stored and installed on local user PC and then detected/loaded by chrome as a plugin. Please tell whether this is correct or not.
Also, I want to ask whether still there exist any way to run NPAPI plugin in chrome or not. If it is please tell otherwise i should not think about it.
First, Chrome no longer supports NPAPI plugins for security reasons:
https://support.google.com/chrome/answer/6213033?hl=en
Plugins must use the Pepper Plugin API (PPAPI) and be compiled as Native Client (NaCl) executables so the plugin binary can be validated as safe to run. Portable Native Client (PNaCl) plugins can be loaded by any web page without the user installing anything. However, if your plugin is large, you may want to distribute it as a Web Application through the Chrome Web Store. In that case, you can bundle your .nexe's or a .pexe with your application so it is effectively installed on the user's machine.
This link describes how you can distribute your plugin:
https://developer.chrome.com/native-client/devguide/distributing
I have been trying to author a Chrome extension recently and have been hitting major problems it seems every step of the way.
Currently I have a local HTML page that is using a local Javascript library. This works great, except Chrome limits the amount of data a page can store to 5MB. I would like to get around this limit, and read that Chrome extensions/applications could use unlimited storage resources via chrome.storage.
While coding, I quickly discovered that this only applies to browser actions, content scripts, and (?) web applications (loading an WWW page as an extension). I was coding this as a local packaged app, which does NOT have access to either the HTML5 localStorage API NOR the chrome.storage API. I really need the extension to use only local HTML/Javascript resources in order to maintain offline/no-internet functionality.
Can a Chrome web app be loaded from a local resource, i.e. a locally packaged HTML page? Is there any way around these problems that does not include enabling dangerous security vulnerabilities in Chrome? I saw that an NPAPI app could solve the problem however that also defeats the purpose of the application I am making.
TIA,
Trann
Apparently this is possible with a packaged app, when the correct combination of permissions are put into the manifest.json:
"permissions": [
"storage",
"unlimitedStorage",
"fileSystem"
]
The fileSystem permission, once added, enabled the FileSystem API to start working as expected (not chrome.storage).
I interest in developer dashboard of chrome web store
when I try to upload text file name manifest.json but inner file doesn't json format
I know that google uses any means to check the file structure
thank for suggest
Before uploading your extension to the webstore, it is really better to test by loading your extension as an "unpacked extension", which you can do by visiting chrome://extensions, expanding "Developer Mode" if it isn't already expanded, and then clicking "Load unpacked extension..."
Loading your extension will allow you to test it and discover issues, long before publishing it to test accounts or to other users. The Chrome extension developers' guide - manifest format documents what is permissible in the manifest. It is also necessary for the manifest to be standard JSON.
Also, I should point out that the Chrome webstore may disallow well-formatted code if it violates the terms (e.g. violating the branding guidelines or seeming to represent a website you don't own).
I found that Chrome store will not accept manifest.json including "// comment", but Chrome developer mode accepts.
I copy and paste from here, and "// Optional" is added to my manifest.json file.
http://developer.chrome.com/extensions/manifest.html
Maybe Chrome developer mode should also reject the comments?