0

我正在尝试编写一个需要在所有帧中使用 jquery 的 chrome 扩展。所以我需要注入 jquery 库。我目前正在这样做

chrome.tabs.executeScript(tabId, {
      'file' : 'js/libs/jquery.min.js',
      'allFrames' : true
    });

但问题是我有一些网站有 15 个框架,我不想注入 15 个 jquery 文件。好像有点过分了。有没有办法只注入一次,所以其他框架可以使用它?

4

1 回答 1

0

You can inject jquery only on the main page and then you will be able to access jQuery inside child frames by using this code: parent.$

于 2012-12-17T22:19:35.037 回答