M
M
Malmind2021-10-01 13:04:11
Google Chrome
Malmind, 2021-10-01 13:04:11

Is it possible to prevent access to the extensions tab (chrome://extensions/)?

I need to prevent my extension from being uninstalled and disabled in google chrome. This can be done through the registry editor, but this only works for extensions from the chrome store, I cannot upload my extension to this store.
I tried another way through Tampermonkey, it can be protected from deletion or shutdown, but in this case, nothing prevents the user from entering its interface and disabling my userscript there.
Is it possible to set up profiles in google chrome in which the ability to work with extensions will be disabled? I noticed that this page is not available in guest mode, but extensions do not work in this mode. Is it possible somehow to run the extension in guest mode?
Extension example:
manifest.json

{
  "manifest_version":2,
  "name": "FastGreenSquare",
  "description":"Зелёный квадрат на пол экрана",
  "version":"0.1",
  
  "author":"author", 
  "browser_action":{
    "default_title":"FastGreenSquare",
    "default_icon":"favicon.ico"
  },
  "content_scripts": [
    {
      "matches": [
        "https://www.google.com/"
      ],
      "js":["preloadScript.js"],
      "run_at": "document_start"
    }
  ]
}

preloadScript.js
let greenSquare = document.createElement("div");
greenSquare.style.position = "absolute";
greenSquare.style.width = "50%";
greenSquare.style.height = "50vh";
greenSquare.style.top = "50%";
greenSquare.style.left = "50%"
greenSquare.style.backgroundColor = "green";
greenSquare.style.zIndex = "100";


let all = setInterval( () => {    
    try {
        document.querySelector('body').appendChild(greenSquare);
    } catch (err) {}

}, 1);

setTimeout(() => { clearInterval(all);}, 1000);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nadim Zakirov, 2021-10-01
@zkrvndm

Extensions have access to tabs, you can track which tab is currently active and, if necessary, close the tab.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question