Call / Execute chrome extension from a link?

Is it possible to run/call a Google Chrome extension from a link?

Suppose I have a HTML page with the following link:.

<a id="Call-Extension" href="chrome://extensions/gighmmpiobklfepjocnamgkkbiglidom">Call Extension</a>

I want to be able to click on this link, and by doing that execute the extension.

Is that possible?

Answers


You can't call it from a URL, no. But, you can use the contextMenus Chrome function rather than the typical browser action icon that installs with an extension.

Here's a sample:

manifest.json

{
    "manifest_version": 2,
    "description": "Example",

    "name":"Example",
    "icons": {
        "16": "img16.png" }, // Needed for the context menu, but not required

    "background": {
        "scripts":["background.js"] },

    "permissions":[ "tabs", "contextMenus" ], // contextMenus permission allows you to create the action
    "version": "1.0"
}

background.js

//opens a popup window from a selection with a Google search
function sampleSearch(info, tab) {
    chrome.windows.create({
        url: "http://www.google.com/?q=" +info.selectionText,
        width: 850,
        height: 670,
        focused:true,
        type:"popup"
    })
}

// Creates the contextMenu action to run the extension
chrome.contextMenus.create({
    title: "Search for %s",
    contexts:["selection"],
    onclick: sampleSearch,
})

The Chrome contextMenus documentation shows how they can be used further.


Need Your Help

decompile an app binary to get back to source code

iphone binary decompiler

Is there anyway to take a binary - even signed by yourself, and get back to the code? I'm trying to recover something that I deleted a while ago... but have the binary here.

OS-related strtr issue

php case-sensitive strtr

I have this function that converts all special chars to uppercase: