admin管理员组文章数量:1316017
I'm trying to install the basic userscript from . I open the page with extensions list in Chrome, drag&drop my extension (copied from the pastebin link above) there and accept the permissions. So, because of the line // @include /*
the userscript should run only on the userscripts, but it doesn't.
I have Chrome 27
so as I know the userscripts should work without Greasemonkey
installed.
What could be wrong and how to check if the userscripts are working (how to debug them so)?
I'm trying to install the basic userscript from http://pastebin./9CXXYYBX. I open the page with extensions list in Chrome, drag&drop my extension (copied from the pastebin link above) there and accept the permissions. So, because of the line // @include http://userscripts/*
the userscript should run only on the userscripts, but it doesn't.
I have Chrome 27
so as I know the userscripts should work without Greasemonkey
installed.
What could be wrong and how to check if the userscripts are working (how to debug them so)?
Share Improve this question edited Oct 20, 2013 at 12:31 Brock Adams 93.6k23 gold badges241 silver badges305 bronze badges asked Oct 10, 2013 at 14:42 staticstatic 8,40615 gold badges65 silver badges91 bronze badges 1- The next question is different, but the answers are identical. I suggest to read stackoverflow./a/11773654/938089. – Rob W Commented Oct 10, 2013 at 18:10
1 Answer
Reset to default 4The question is not clear. Are you having trouble installing the script, or running it, or just what it reports.
Anyway, that script works fine for me.
To install it:
- Download the file from pastebin to your local machine.
- Rename the file. It es from pastebin named crossvrowser_userscript_pattern.txt (sic), but userscripts must end in
.user.js
. So, rename the file tocrossbrowser_userscript_pattern.user.js
. - Install
crossbrowser_userscript_pattern.user.js
by dragging it to the extension page, per this question and answers.
Permission report:
Chrome will report that the userscript can operate on all web sites, but Chrome lies about scripts that use @include
. It's not a problem here.
Running the script:
After installing that script, it runs just as expected. When going to a page on userscripts, the script alerts, "Hello from the userscript," just like it should.
If the script doesn't run:
Go to the extensions page (chrome://extensions/
), does the script show up? You should see something like:
Then when you visit a suitable page you will see the alert:
You can also open Chrome's console (CtrlShiftI) and switch to the userscript's scope:
Note that the id (pfnbaeafniclcjhfkndoploalomdmgkc
) is the same as that listed on the extensions page.
You can then view the script source live, add breakpoints and debug it by following the directions in this answer.
本文标签: javascriptHow to install a userscript in chrome (added scripts cannot run)Stack Overflow
版权声明:本文标题:javascript - How to install a userscript in chrome (added scripts cannot run)? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741994580a2409784.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论