我可以将Javascript代码注入Chrome自定义标签中吗 [英] Can I inject Javascript code into Chrome Custom Tabs
问题描述
在我的应用中,我当前正在使用网络视图来显示一些内容.然后,我使用Javascript注入为用户快速填写表单.
In my app, I am currently using a web view to display some content. Then, I use Javascript injection to quickly fill out the form for the user.
唯一的问题是,与Chrome自定义标签相比,Webview的运行速度慢得令人难以置信.是否可以将Javascript代码注入这些自定义标签中?
The only issue is, Webviews are incredibly slow compared to Chrome Custom tabs. Is it possible to inject Javascript code into these custom tabs?
例如,这是我当前使用的一些代码:
For example, here is some code I currently use:
myWebView.loadUrl("javascript:document.getElementById('join_first_name').value='" + name + "';void(0); ");
推荐答案
否;那将是一个严重的安全漏洞.
No; that would be a critical security hole.
由于自定义标签使用了用户真实Chrome实例中的Cookie,设置和密码管理器,因此您根本无法对其进行控制.
Since custom tabs use cookies, settings, and password managers from the user's real Chrome instance, you cannot control them at all.
这篇关于我可以将Javascript代码注入Chrome自定义标签中吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!