0

I'm trying to install the basic userscript from http://pastebin.com/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.org/* the userscript should run only on the userscripts.org, 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)?

1

1 Answer 1

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 comes 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.org, 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:

Script installed


Then when you visit a suitable page you will see the alert:

Script's alert



You can also open Chrome's console (CtrlShiftI) and switch to the userscript's scope:

Switch to script 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.


Debugging OP's script in action

Sign up to request clarification or add additional context in comments.

3 Comments

I do all the same you described. I have problems only with running user scripts. So the last point you mentioned is not working for me: if I go to the userscripts.org there is no alert at all. Should it alert on each page I visit, if I will remove the @include line?
Yes, if you remove the @include (not recommended!) and reinstall the script, then it will alert on each page. See the updated answer for more.
sorry, had no time before. thank you very much for the edit! I will try at this next days (I read the edit, and I think I lost some steps you mentioned above, but I need to try and check)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.