V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
morgan1freeman
V2EX  ›  问与答

Search web in side panel , Chrome 被强迫右键 side 搜索了

  •  
  •   morgan1freeman · 2023-08-08 15:15:56 +08:00 · 419 次点击
    这是一个创建于 458 天前的主题,其中的信息可能已经有所发展或是发生改变。
    Search web in side panel , Chrome 被强迫右键 side 搜索了

    有什么办法解决

    网上搜索到的两个 选项我都 disable 掉了,右键还是 search google for XXXX new
    morgan1freeman
        1
    morgan1freeman  
    OP
       2023-08-08 19:33:09 +08:00
    main.js

    ```javascript
    chrome.contextMenus.create({
    title: "Search Google for '%s'",
    contexts: ["selection"],
    onclick: function(info, tab) {
    chrome.tabs.create({
    url: "https://www.google.com/search?q=" + encodeURIComponent(info.selectionText)
    })
    }
    });
    ```

    manifest.json
    ```json
    {
    "manifest_version": 2,
    "name": "Right Click Search Google",
    "version": "1.0",
    "description": "Search selected text on Google with just a right-click.",
    "permissions": [
    "contextMenus"
    ],
    "background": {
    "scripts": ["main.js"],
    "persistent": true
    }
    }
    ```

    popup.html

    ```html

    <!doctype html>
    <html>
    <head>
    <title>Right Click Search Google</title>
    </head>
    <body>
    <h1>Right Click Search Google</h1>
    <p>This plugin allows you to search selected text on Google with just a right-click.</p>
    </body>
    </html>

    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   984 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 22:11 · PVG 06:11 · LAX 14:11 · JFK 17:11
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.