Android - Is there a way to use PC browser bookmarklets with the Android Browser or Dolphin HD?

Solution:

Finally got it to work and it wasn't complicated at all.

Simply create a bookmark and paste the javascript into the URL field. I've tried it on this bookmarklet that does a google definition search:

javascript: s = (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (s == '') { l = parent.frames.length; if (l != 1) { for (i = 0; i < l; i++) { s = parent.frames[i].document.getSelection ? parent.frames[i].document.getSelection() : parent.frames[i].document.selection.createRange().text; if (s) { break; } } } } if (s == '') { void( s = prompt('Google Define: Enter a term or mark some text.','') ); } if (s) { s = String(s); s = s.replace(/^s*|s*$/g,''); s = escape(s);void( bmw = open('http://www.google.com/search?num=100&start=0&q=define:'+s+'','GoogleDefineBM'+String(Math.round(Math.random()*1000))) );}

To get it saved as a bookmark I just saved the text in evernote then copied it on my phone an pasted it in the url field of "new bookmark." To make it even easier to access I created a custom dolphin gesture that opens it as "Go To URL". Now when I'm browsing and I want to lookup a word I hit the gesture button and draw a "d" and it brings up a popup that allows me to lookup the word.

I've only tried this on Dolphin Browser HD.


Works in Chrome mobile. Here's the recipe:

PREPARE

Create a bookmarklet = add a script to your bookmarks:

  • on Chrome PC¹, then sync (so your bookmarks show up in Chrome mobile on your phone)
  • or directly in Chrome mobile on your phone²

USE

Do not invoke/call the script (on phone) by looking it up in Chrome Bookmarks (menu [ ] / Bookmarks) → that doesn't work. You have to tap the URL bar and start typing the bookmarklet's name. Select the bookmarklet from the list (it'll begin with javascript:blahblahblah…).


¹) on any webpage hit Chrome's button [ ] on URL bar then [More] in the popup that appears, then enter the bookmarklet name, URL (=code beginning with javascript:blahblahblah…), optionally choose folder, then hit [Save]

²) on any webpage hit Chrome's button [ ] then [ ] then [Edit] on a bar that shows down the screen, then enter the bookmarklet name, URL (=code beginning with javascript:blahblahblah…), optionally choose folder, then hit [] to save and go back