28

I would like to be able to use userscripts in Android. Is this even possible? I read that it was a couple months back and tried a tutorial which I can no longer find but it didn't work.

This question may be related to this other one I submitted but I believe they may have totally different answers.

2

5 Answers 5

6

Use OilCan - "Greasemonkey on steroids for Android".

2
  • Have you tried it? I'm pretty sure this is the one I tried but couldn't get to work. It was a while ago when I was still new to Android so I might have better luck now.
    – Matt
    Commented Sep 16, 2010 at 21:56
  • I haven't tried it yet. Looks cool though so I will give it a try soon and see what happens. Commented Sep 20, 2010 at 20:03
15

2019 Update:

My preferred way to get userscripts on Android would now be to use the Firefox browser, which has working, well-maintained Add-ons available for both Greasemonkey and Tampermonkey (search for them through the Add-ons menu in the Firefox app).

Pasting the javascript into the address bar still works (at least on Chrome), but note that Chrome now strips out the javascript: prefix when you paste in the code. If you don't retype it, it will just do a web search.

The mobile versions of Chrome and Opera (also now based on Chromium) don't support userscript add-ons, but the Tampermonkey standalone app is still available from the Play Store. It hasn't been updated since 2013 but still just about works. However, given its age, it won't support many of the features of the current Greasemonkey/Tampermonkey API, or modern websites in general. As a result, many userscripts won't work without modification. It's also tricky to figure out how to install them in the first player (use the 'Textarea' utility hidden under the Advanced Settings). There are also Tampermonkey extensions for the Dolphin and UC browsers available in the Play Store. I haven't tried them, but they haven't been updated since 2016.

Original 2013 answer:

Solution 1. Use Tampermonkey. Tampermonkey is more popular as an extension for Chrome, but it is also available as a standalone Android app. It functions as a lightweight browser, and allows you to manage and automatically run user scripts. Unfortunately it doesn't have many of the features found on other popular browsers, but it does support the Greasemonkey API.

Solution 2. Use Opera Mobile, which has built-in support for userscripts, but no script management features, and doesn't support the Greasemonkey API. Navigate to the User Prefs section of opera:config, then tick "Always Load User JavaScript" and "User JavaScript". Enter the path to a folder (not a file) in the "User JavaScript File" field (I use /sdcard/userscripts/), then store the settings. Save your userscript in that folder with a .user.js extension. NB this works in OM12, but the OM14 beta doesn't seem to support userscripts at present.

Solution 3. Launch your userscript manually via a bookmarklet or pasting this javascript directly into the browser address bar:

javascript:(function(){var a=document.createElement("script");a.src="http://path.to/myscript.user.js";document.head.appendChild(a);})();

This technique is tedious, but the principle should work in most browsers. You don't get Greasemonkey API support though. The code above should work without modification in the stock Android browser, and can be saved as a bookmarklet. In Chrome Mobile the space in the var a needs escaping, i.e. var%20a=, and bookmarklets don't seem to work, so you have to paste manually every time.

6
  • I guess you should advise the people who use the 3rd option. The userscript engine is more than append a js file to the current dom. Is not only the API, it's the sandbox features.
    – m3nda
    Commented May 2, 2015 at 23:10
  • 1
    The current version of Opera for Android does not support user javascript. Commented Aug 31, 2015 at 19:05
  • Option 3 did not work for me, unfortunately. It just google-searched the string until I realized that the javascript: portion at the front wasn't actually pasting into the URL bar (how annoying!) Commented Apr 25, 2016 at 19:11
  • Please note that a script won't load if you are on a https:// site but load s script from http:// and also, in newer browsers, you may have to fiddle around with about:config to enable loading of scripts from another domain on some sites who disable it in their <meta> tag in their <head> section
    – mxl
    Commented May 11, 2020 at 10:18
  • My Firefox android is not compatible with either tampermonkey or greasemonkey addons. Are you sure ? Commented Aug 18, 2021 at 16:37
2

Use either the Habit Browser or Slepnir Browser apps. They both support Userscripts. I had to tweak my scripts slightly to get them working (they handle events differently) but they both work really well.

1
  • Do you have any instructions on how to install a userscript with either? I played around with Sleipnir for an hour and could not figure out how to do so. Commented Apr 25, 2016 at 20:07
2

There is a Greasemonkey-like add-on for Dolphin called Tampermonkey. There is also a stand-alone Tampermonkey app, but Dolphin is a more full-fledged browser than that thing.

There is also a similar add-on for Firefox for Android, called USI.

2
  • 5
    Dear lord, Tampermonkey's browser is awful. No cookies, no bookmarks, no passwords, no tabs. It's the barest of barebones and not even worth using. Commented Apr 25, 2016 at 19:03
  • Firefox does support plugins on mobile, woot.
    – rogerdpack
    Commented Aug 1, 2017 at 20:17
2

You can run userscripts on your phone by installing Violentmonkey on Kiwi Browser or Iceraven.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .