I'm trying to make a chrome extension, and i need it to apply a script if the URL is https://accounts.google.com/........#identifier
But this isnt working
Why?
我正在尝试制作Chrome扩展程序,如果网址为https://accounts.google.com/mass#identifier,我需要它来应用脚本但是这不起作用为什么?
manifest.json
"content_scripts": [{
"matches": ["https://accounts.google.com/*#identifier"],
"js": ["myJS.js"]
}]
1 个解决方案
#1
0
For url containing anchor(#
), the web request actually is still sent to https://accounts.google.com/
without the part after #
, so your match pattern won't match what you want.
对于包含锚点(#)的网址,网页请求实际上仍会发送到https://accounts.google.com/,而不是#之后的部分,因此您的匹配模式将与您想要的不匹配。
You could set "matches": ["https://account.google.com/*"]
here and wrap your method inside window.onhashchange
listener, in that method, to detect if location.hash === "#identifier"
.
您可以在此处设置“匹配”:[“https://account.google.com/*”]并将您的方法包装在window.onhashchange侦听器中,在该方法中,以检测location.hash ===“#identifier” 。
#1
0
For url containing anchor(#
), the web request actually is still sent to https://accounts.google.com/
without the part after #
, so your match pattern won't match what you want.
对于包含锚点(#)的网址,网页请求实际上仍会发送到https://accounts.google.com/,而不是#之后的部分,因此您的匹配模式将与您想要的不匹配。
You could set "matches": ["https://account.google.com/*"]
here and wrap your method inside window.onhashchange
listener, in that method, to detect if location.hash === "#identifier"
.
您可以在此处设置“匹配”:[“https://account.google.com/*”]并将您的方法包装在window.onhashchange侦听器中,在该方法中,以检测location.hash ===“#identifier” 。