我想把JavaScript注入到一个移动浏览器上的网站(在这个例子中是在安卓系统上)。然而,大多数移动浏览器似乎不支持任何类型的插件(除了Firefox,如果我错了,请纠正我)。
火狐对移动插件开发的支持似乎也很少,例如,你不能通过下载来安装xpi文件(我还没有发现如何安装一个不在add-ons for android site上的插件)
为什么不使用现有的解决方案?
最好的注入javscript的方式是Greasemonkey,但是在移动端不支持。Scriptish应该是,但我无法在任何设备上安装它。有一些android浏览器专门编写来支持Greasemonkey脚本(Fat Ape、Tampermonkey或OilCan),但是这些浏览器并没有被很多人使用,虽然它们支持JavaScript注入,但它们缺乏对其他浏览器功能的支持。
我的问题到底是什么?
我在火狐插件开发方面的经验很少,所以我想知道:有什么东西会阻止像this这样的东西在FF-Mobile上运行吗?在其他浏览器上也能做到吗?我实际上并不需要Greasemonkey的全部功能,只需在任何网站中添加几行代码就可以了。
发布于 2014-02-23 02:14:12
更新
这需要更新!新的Firefox现在已经完全支持Greasemonkey插件了!
使用说明:
旧
运行Opera Mobile Labs应用程序,访问Violent Monkey's extension网站,点击“添加到Opera”安装1.5.1.1 (OEX版本),然后选择“确定”(也许你必须重启Opera Mobile才能使扩展生效)。
要安装用户脚本,您只需通过访问user.js URL位置将其加载到浏览器中。如果你的SD卡上有用户脚本,你可以通过在地址栏中输入"file://“”来加载它们,然后导航到你的user.js文件,然后选择“OK”。
- Save your user.js scripts in a folder on your SD card (eg. "/sdcard/js").
- Run Opera Mobile app and enter "opera:config" into the address bar and then in the "Quick find" input enter "javascript". Go down and under "User Prefs" tick the following: "Always Load User Javascript" and "User Javascript". Under "User Javascript File" enter the path to the folder with your user.js files (eg. "/sdcard/js").
- At the end don't forget to tap "Save" otherwise your setting will not be saved! Restart Opera!如果你不想下载APK文件,那么第二种方法也适用于Opera Mobile Classic。你可以在Play Store中找到该应用程序。
发布于 2013-06-06 18:17:05
如果您可以在手机上安装Google Chrome (Android > 4.0),就可以进行远程调试。
谷歌手机浏览器概述:https://developers.google.com/chrome/mobile/docs/overview
远程调试概述:https://developers.google.com/chrome-developer-tools/docs/remote-debugging
发布于 2016-02-10 00:11:44
在移动设备上运行用户脚本的另一个选择是Tampermonkey用户脚本管理器。在Dolphin和UC Android浏览器上都有Tampermonkey的附加组件。
用于Dolphin Web浏览器的坦珀猴插件:https://play.google.com/store/apps/details?id=net.tampermonkey.dolphin
用于UC网络浏览器https://play.google.com/store/apps/details?id=net.tampermonkey.uc的Tampermonkey附加组件
要使用它们,首先需要安装相应的浏览器。
https://stackoverflow.com/questions/16959155
复制相似问题