我在来源中读到,当 chrome 进入某个域时,它会预取可能用于该域的大部分页面。因此,我面临着一个问题。我有一个greasemonkey脚本,它将被注入到每个页面中。但似乎发生的情况是,浏览器注入了域中第一页的脚本,当我转到另一个页面时,该脚本仍然存在,而不是被重新注入(这就是我想要的)。关于如何实现这种行为的任何想法?
I read in a source that chrome, when it goes to a domain, it prefetches most of the pages that might be used for that domain. As a result of this, I'm facing a problem. I have a greasemonkey script which is to be injected in every page. But what seems to happen is that the browser injects the script for the first page in a domain and that remains when i go to another page, instead of being re-injected (which is what i would want). Any ideas on how i could achieve this behavior ??
发布评论
评论(2)
Google Chrome 会在页面上预缓存 DNS 条目,但它不会主动去获取页面,而 Firefox 会预获取页面。
Google Chrome will precache DNS entries on the page but it doesn't pro-actively go and fetch pages, Firefox however, does prefetch pages.
实际上,在某些情况下,Chrome 会主动预先缓存缓存清单中提到的任何页面。这是专为离线场景设计的。但是,下载后的每个页面都不会针对任何注入的脚本执行,也不会在这些页面上运行任何 JS。
Actually, there is a case where Chrome will proactively pre-cache any page that is mentioned in the cache manifest. This is designed for offline scenarios. However, each page when downloaded will not be executed against any injected script, nor will it run any JS on those pages.