Updated
Thanks @kofifus for the info, Chrome as of 61 explicitly forbids content scripts on its default new tab page
Previous
Say I have the following sample extension, it will output test
in console.
manifest.json
{
"name": "Test",
"version": "1.0",
"manifest_version": 2,
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"content.js"
]
}
]
}
content.js
console.log('test');
Will above extension work well in chrome://newtab
page?
Some helpful info:
I know by default chrome extension can't access to
chrome://
pages, and we could change this behavior throughchrome://flags/#extensions-on-chrome-urls
chrome://newtab
in fact is a url likehttps://www.google.co.jp/_/chrome/newtab?espv=2&ie=UTF-8
, so it shouldn't be blocked by above restriction.There are many mouse gestures extension available, like crxMouse, they work well on
chrome://newtab
pageThere are also some voices saying it's not allowed to inject content scripts in
chrome://newtab
, for example, @Xan's comments below this answer and this author's case
So it looks weird as its different behavior across different devices( or settings?). Is there any official statements about whether content scripts can run in chrome://newtab
pages? Or is there a setting we could change this behavior?