The following are Chrome's infobar and the one I wrote for the plugin, respectively:
Demo
I've set up a small demo of the plugin here: http://www.dreasgrech.com/upload/extinfobar/.Download
The plugin can be found at the jQuery plugins site: http://plugins.jquery.com/extinfobar/
You can get the full source of the plugin from https://github.com/dreasgrech/ChromeExtInfoBar
These are all the images that you need:
Usage
The simplest way to use the plugin is to simply invoke it using just your Chrome extension ID:$.fn.extInfobar({ id: 'nbilgjjflfiiijecdjpnbganoiafneph' });
You can also specify a custom message to be displayed on the infobar, as opposed to the default message:
$.fn.extInfobar({ id: 'nbilgjjflfiiijecdjpnbganoiafneph', message: 'This is my custom message I want to show on the infobar' });
There are three other optional parameters you can pass; redirectIfInstallFails, rememberClose and rememberRedirect. All three default to true if unspecified.
$.fn.extInfobar({ id: 'nbilgjjflfiiijecdjpnbganoiafneph', message: 'This is my custom message I want to show on the infobar', redirectIfInstallFails: false, rememberClose: false, rememberRedirect: false });
redirectIfInstallFails specifies whether the plugin should redirect the user to the extension's Chrome Webstore page if the installation happens to fail or if the site you're using the plugin on is not verified (more info on that below).
When the user clicks on the close button, the action is remembered via localStorage so that the bar is not displayed again for him but the rememberClose parameter allows you to override this functionality; so if you set it to false, the bar will keep appearing on subsequent page visits even if the user closed it.
The last parameter, rememberRedirect, is used to save the action of the plugin redirecting the user to the extension's Chrome Webstore; by default, the action is saved which means that once a user is redirected to the Chrome Webstore page, the bar will not be shown to him on subsequent visits to your page, but you can of course override this functionality by setting rememberRedirect to false.
How it works
The plugin makes use of Chrome's inline installation functionality, but note that this only works if your extension's website is verified and this plugin is invoked from the same domain as the verified site.When you click on the 'Install' button on the infobar, and the context meets the two aforementioned criteria, the following modal dialog will pop up:
Otherwise, the user will be redirected directly to the extension's page on the Chrome Webstore (unless the redirectIfInstallFails option is explicitly set to false).