2012-07-30 35 views
-1

我的內容腳本會在頁面中插入一些按鈕。當我點擊按鈕時,它會執行一些操作,例如console.log(「...」),也許它會使用鼠標選擇。我的內容腳本如何在iframe中工作?

當頁面有iframe時可以工作嗎?

+0

取決於iframe內容是否在同一個域中。 – Daedalus 2012-07-30 03:33:19

+0

就像http://developer.apple.com/library/ios/#technotes/tn2239/_index.html – Tom 2012-07-30 03:40:18

+0

這不能回答我的問題。 – Daedalus 2012-07-30 03:58:33

回答

1

您應該在manifest.json中將all_frames: true添加到您的content scripts聲明中。

"content_scripts": [ 
    { 
     "matches": [ 
      "http://*/*", 
      "https://*/*" 
     ], 
     "all_frames": true, 
     "js": [ 
      "content_script.js" 
     ] 
    } 
] 
+0

它似乎不起作用。 – Tom 2012-07-30 07:21:50

+0

我只是在這裏嘗試它http://developer.apple.com/library/ios/#technotes/tn2239/_index.html 它不起作用。 – Tom 2012-07-30 07:29:49

+0

@Tom「不行」不是問題描述;請發佈您在控制檯中收到的錯誤。 – Daedalus 2012-07-30 18:13:22