'How to open chrome extension from Node.js
I am trying to open a chrome extension written in Reactjs from the backend (Node.js) as follows:-
@Get('openExtension')
async openExtension(@Res() response) {
response.redirect(303,`chrome-extension://nflcbnkidblhlmkflgjngmgfjojmpibk/index.html );
}
but this is changing the URL but not rendering my extension:
.
After reloading the page, this works fine:

Solution 1:[1]
This is not allowed. A website cannot direct the user to a secure local page like chrome://, chrome-extension://, file:// or the like. You need to let the extension do that for you, since an extension can have more privileges than a website.
- You can open a page on your server and have your extension detect that page and initiate the navigation to the extension page from there. (That page could by default display instructions how to install the extension, given that it will only be actually shown if the extension is not running and redirecting that page for you.)
- Or, if the whole thing is already initiated from frontend code anyway, you can send a message to your extension to handle it. Also take a look at this article - you will need to send a message to your own window from website JavaScript and then have a content script listen on that message and forward it to the background page with
chrome.runtime.sendMessage, because a website cannot directly access the Chrome extension API.
See also this answer (the use case is slightly different, but the same idea applies).
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 |
