'Send message from webpage to extension

I want send message from webpage to chrome extension, but it not working. I see background function not receiving message send from content.js Here:

manifes.json:
{
    "name": "My Checker",
    "version": "1.0",
    "description": "http://www.abc.dev Extension!",
    "manifest_version": 2,
    "permissions": [
        "*://*.google.com/",
    ],
    "background": {
        "scripts": ["background.js"],
        "persistent": false
    },
    "content_scripts": [
        {
            "matches": ["*://*.abc.dev/*"],
            "js": ["jquery-3.3.1.min.js", "content.js"],
            "run_at": "document_end"
        }
    ],
    "externally_connectable": {
        "matches": ["*://*.abc.dev/*"]
    },
    "browser_action": {
        "default_popup": "popup.html"
    }
}

And background.js:

console.log("background page in loading...");
chrome.runtime.onMessageExternal.addListener(
    function(request, sender, sendResponse) {
        console.log("listener for request");
        console.log(request);
        if (request.openUrlInEditor)
            console.log("Open :" + request.openUrlInEditor);
        sendResponse({success : "success"});
    }
);

And content.js:

chrome.runtime.sendMessage("acldjllcapdfejdafbkjnfmpahdkendo", {openUrlInEditor: "https://www.google.com"}, function(response) {
        if (response && !response.success)
            handleError(url);
    }
);


Solution 1:[1]

Cross-extension messaging.

you can use the messaging API to communicate with other extensions. This lets you expose a public API that other extensions can take advantage of.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Henok Ayele