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

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

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

    有什么办法解决

    网上搜索到的两个 选项我都 disable 掉了,右键还是 search google for XXXX new
    morgan1freeman
        1
    morgan1freeman  
    OP
       269 天前
    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   ·   我们的愿景   ·   实用小工具   ·   868 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 22:50 · PVG 06:50 · LAX 15:50 · JFK 18:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.