简体   繁体   English

有没有办法将用户脚本注入移动网页并在重新加载后保留?

[英]Is there a way to inject userscript into mobile webpage and keep it after reloading?

I created an userscript to help me farm on a browser game.我创建了一个用户脚本来帮助我进行浏览器游戏。 I have been running it in the background, on my pc, and everything was going on great, but.我一直在后台运行它,在我的电脑上,一切都很好,但是。

I want to be able to run it on my old phone so that I won't have to keep my pc open all the time (I wanna run this 24/7).我希望能够在我的旧手机上运行它,这样我就不必一直打开我的电脑(我想 24/7 运行它)。 I have tried using tampermoney for android, but I couldn't get it to work at all, so I started using DevTools and injecting the javascript code into the page manually trough console with a Snippet.我已经尝试对 android 使用 tampermoney,但我根本无法让它工作,所以我开始使用 DevTools 并将 javascript 代码手动注入到页面中,通过控制台使用代码片段。

The problem is that the game session expires after a while, and I couldn't find a method to log back in without refreshing the page, but once I do that, the script is lost and I have to reconnect my phone to my pc and inject it using DevTools.问题是游戏 session 会在一段时间后过期,如果不刷新页面我找不到重新登录的方法,但是一旦这样做,脚本就会丢失,我必须将手机重新连接到我的电脑,然后使用 DevTools 注入它。

Is there any way I could keep the Snippet after refreshing, inject the userscript without DevTools or is there any other solution you can think of?有什么办法可以在刷新后保留代码段,在没有 DevTools 的情况下注入用户脚本,或者您能想到其他解决方案吗?

Greasemonkey was available for older Firefox versions on Android.Greasemonkey可用于 Android 上的旧 Firefox 版本。 I think support stopped around August 2020. Until then it seemed to work fine to me.我认为支持在 2020 年 8 月左右停止。在那之前,它对我来说似乎工作得很好。 I don't know if it is still possible to install Greasemonkey if you install an old Firefox version on Android but it's worth a try.如果您在 Android 上安装旧的 Firefox 版本,我不知道是否仍然可以安装 Greasemonkey,但值得一试。

Another solution would be to create your own Android app.另一种解决方案是创建您自己的 Android 应用程序。 In an Android app you can use WebView to display a website and inject javascript with evaluateJavascript(codestring, callback)在 Android 应用程序中,您可以使用WebView显示网站并使用evaluateJavascript(codestring, callback)注入 javascript

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM