AndroidWebView由于弹出窗口,不允许使用@solid/react库进行身份验证。
创始人
2024-10-12 03:30:58
0

一种可能的解决方法是使用自定义WebView,强制WebView允许弹出窗口。以下是一个使用Kotlin编写的示例代码:

class CustomWebView : WebView {

    constructor(context: Context) : super(context)

    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)

    constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )

    override fun onCreateWindow(
        view: WebView?,
        isDialog: Boolean,
        isUserGesture: Boolean,
        resultMsg: Message?
    ): Boolean {
        val newWebView = WebView(context)
        val transport = resultMsg?.obj as WebView.WebViewTransport
        transport.webView = newWebView
        resultMsg.sendToTarget()
        return true
    }
}

在此示例中,我们创建了一个名为CustomWebView的WebView类,并重写了onCreateWindow方法。该方法充当来自WebView的请求弹出新窗口的拦截器。我们创建了一个新的WebView实例,将其传递给transport.webView,然后返回true以告知WebView引擎去处理请求。接下来,我们可以在我们的活动中使用CustomWebView:

val webView = CustomWebView(this)
webView.settings.javaScriptEnabled = true
webView.webViewClient = WebViewClient()
setContentView(webView)

这样做应该允许@solid/react库在WebView中进行身份验证,而无需弹出窗口问题。

相关内容

热门资讯

透视教你!pokemomo辅助... 透视教你!pokemomo辅助软件(透视)hhpkoer辅助器,教程项目(竟然有挂)-哔哩哔哩pok...
wpk德州局怎么透视!wepo... wpk德州局怎么透视!wepoker国外版透视(透视)教程-切实必备真的有挂wpk德州局怎么透视辅助...
透视有挂!hhpoker视频巡... 透视有挂!hhpoker视频巡查真的假的(透视)hhpoker免费辅助器,教程攻略(有挂教学)-哔哩...
hhpoker开挂教程!wep... hhpoker开挂教程!wepoker透视苹果系统(透视)技巧-都是解谜是有挂1)wepoker透视...
透视解迷!hhpoker德州真... 透视解迷!hhpoker德州真的假的(透视)wepoker祈福有用吗,教程讲义(有挂透明挂)-哔哩哔...
德州局透视!菠萝辅助器免费版的... 德州局透视!菠萝辅助器免费版的特点(透视)app-好像了解真的有挂1、下载好菠萝辅助器免费版的特点透...
pokerrrr2辅助!wep... pokerrrr2辅助!wepoker有没有辅助(透视)插件-切实解谜真的有挂wepoker有没有辅...
透视曝光!pokemmo脚本辅... 透视曝光!pokemmo脚本辅助(透视)wepoker怎么设置透视,教程演示(发现有挂)-哔哩哔哩w...
wepoker怎么拿到好牌!德... wepoker怎么拿到好牌!德州之星扫描器(透视)软件-果然专业有挂1)wepoker怎么拿到好牌免...
透视必备!fishpoker透... 您好,wejoker辅助机器人这款游戏可以开挂的,确实是有挂的,需要了解加去威信【485275054...