Google Chrome extension - how to turn JavaScript on/off?

后端 未结 5 2096
自闭症患者
自闭症患者 2020-12-12 22:26

Is it possible to turn JavaScript on/off with a self-made Google Chrome extension?

For example, in Opera browser, there are simple possibilities t

5条回答
  •  轮回少年
    2020-12-12 22:58

    Currently, we can NOT access chrome://settings/content data with your Chrome extension

    In my code, when tab "chrome://settings/content" created, the alert(0) does NOT work, and always get the follow error:

    Error during tabs.executeScript: Cannot access contents of url "chrome://settings/content". Extension manifest must request permission to access this host.

    but when tab "http://www.google.com.hk" created, alert(0) works.

    So I think we can NOT access chrome://settings/* data :

    popup.html:

    
    
    
    
    
    
    
    
    
    

    manifest.json:

    {
      "name": "ImageSwitcher",
      "version": "1.0",
      "description": "Disable/Enable loading image",
      "browser_action": {
        "default_icon": "icon.png",
            "default_popup": "popup.html"
      },
      "permissions": [
        "tabs",
            "*://*/*"
      ]
    }
    

提交回复
热议问题