I tried this in firefox for android and it did not work. What gets opened instead is a google search for "javascript:(function()...".
Firefox used so be super useful on Android, but since its redesign almost all its customizability has been gone. So sad.