0

私の最初のchorme extを作りました。古いコンプでも問題なく動作します。新しいものを使用して、展開された ext をロードしようとします。そして、それはまったく機能しません。外部ポップアップ広告 bg.html が表示されますが、コンテンツ スクリプトがまったく読み込まれませんでした。他の展開された ext は正常に動作します。しかし、私の拒否は機能します(助けてください! manifest.json:

{
    "background_page": "bg.html",
    "name": "lardi trans",
    "version": "1.0",
    "icons": {
        "48": "icon_48.png"
    },
    "browser_action": {
        "default_icon": "icon_48.png",
        "default_title": "Lardi Trans",
        "default_popup": "popup.html"
    },
    "permissions": [
        "tabs",
        "notifications",
        "http://lardi-trans.com/gruz/*",
        "http://lardi-trans.com/trans/*",
        "unlimitedStorage"
    ],
    "content_scripts": [{
        "matches": [
            "http://lardi-trans.com/gruz/*",
            "http://lardi-trans.com/trans/*"
        ],
        "css": ["extent_styles.css"],
        "js": ["jq.js", "script.js"],
        "run_at": "document_end"
    }]
}

ext が必要なページのスクリーンショット フォームコンソール ショット と他の ext スクリプトがこのように読み込まれる必要がある場所をマーク します。スクリーンショット2 (5 回同じスクリプト? WTF??) とにかく、ext script.js が表示されない (なぜ読み込まれないの?)

4

2 に答える 2

1

manifest.json ファイルへの css のリンクを指定する必要はありません。ただ、bg.htmlで呼び出します

私の manifest.json ファイル


{
  "name": "Example",
  "version": "2.0",
  "description": "Example.com Description",
  "icons": { "16":"Images/Example/16x16.png", "32":"Images/Example/32x32.png", "48": "Images/Example/48x48.png", "64": "Images/Example/64x64.png", "128": "Images/Example/128x128.png" },

  "app": 
  {
        "default_icon": "../Images/Example/icon.png",
        "launch": 
        {
            "local_path": "Pages/Index.html"
        }
  },

  "permissions": [ "http://www.Example.com/", 
                   "http://*.Example.com/", 
                   "https://www.Example.com/",
                   "https://*.Example.com/",
                   "unlimitedStorage",
                   "tabs",
                   "notifications"
                   ],
  "options_page": "Pages/Options.html",
  "background_page": "Pages/Background.html"
}

その答えが役に立った場合は、答えとしてマークしてください...

それでもエラーが発生する場合は、その回答の最後まで質問してください。

よろしくお願いします。

編集

エラーの表示 - 手順;

拡張ボタンをクリックして開きます。

F12 キーで Google Chrome のデバッグ ウィンドウを開きます。

「コンソール」タブページをクリックします。

そのスクリーンショットを撮り、質問に写真を投稿してください。

そうすれば、誰もがあなたを助けることができます=)

編集2:

あなたの質問は今少し違うように見えます。

これがアルゴリズムです。

対象のウェブページのサイトソースコードをjqueryでダウンロード, css行をheadタグにjsonで挿入, 新しいソースコードをlocalStorage( html5 )に保存 完了したらjsでページを更新, localStorageから新しいソースコードを読み込み, に表示html.

于 2012-04-13T08:19:16.440 に答える
0

誰かが興味を持っている場合は、問題が解決しました。何らかの理由でマニフェストに unprop 空白を追加すると、"content_scripts": [{ "matches": ["http://lardi-trans.com/gruz/*","http://lardi-trans.com/trans/*"], これが機能します!))

于 2012-04-14T11:00:52.697 に答える