我有一个 Google Chrome 扩展程序,其 list .json 中包含以下内容脚本语法:
"content_scripts": [
{
"matches": [
"https://example.com/*"
],
"js": ["js/jquery-2.1.1.js", "js/custom.js"],
"run_at": "document_end",
"all_frames": true
}
],
在 Ember 网站上测试此扩展时,它在初始页面加载时运行,但在更改页面后,它不会再次注入(inject)。
对于非 Ember 用户,Ember 可以更新 URL 和页面内容,而无需执行整个页面重新加载,这似乎会导致此问题。
有人知道这样的示例的解决方法吗?
最佳答案
此问题已通过使用 chrome.WebNavigation.onHistoryStateChanged 修复每次页面更新时都会触发。
关于javascript - Chrome 内容脚本未在 Ember 网站上执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35442137/