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
Add a ment  | 

1 Answer 1

Reset to default 4

The 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:

  1. Download the file from pastebin to your local machine.
  2. Rename the file. It es from pastebin named crossvrowser_userscript_pattern.txt (sic), but userscripts must end in .user.js. So, rename the file to crossbrowser_userscript_pattern.user.js.
  3. 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