4

我即将开发一个浏览器插件来检测页面是否为 WML,如果是,它将通过 API 转换为 HTML。

我想要做的是覆盖onPageFinishedWebViewClient从中获取 MIME 类型WebView。但是这两个类中似乎没有这种方法。

我错过了什么还是有其他方法?任何建议将不胜感激。

4

2 回答 2

2

您可以尝试使用MimeTypeMap

getFileExtensionFromUrl()其次是getMimeTypeFromExtension()

于 2011-07-29T05:02:46.140 回答
1

I have just come up with an idea and seems work.

Load a javascript with loadUrl when the page is finish loading (onProgressChange to 100%). The js code is like

javascript:(function() {
    var wml_root = document.getElementsByTagName('wml');
    if (wml_root && wml_root.length > 0) {
        // apply an XLST or do something here...
    }
})()
于 2011-07-29T12:27:34.447 回答