【问题标题】:Handling mime type with app, in Android browser在 Android 浏览器中使用应用程序处理 mime 类型
【发布时间】:2012-01-12 21:06:18
【问题描述】:

有没有办法在 Android 浏览器中注册特定于 mimetype 的插件?例如,一些程序添加了“应用程序/特定格式”插件处理程序,可以在 navigator.plugins 中看到。我看过示例代码,并尝试过类似example plugin:

<service android:name=".SamplePlugin">
    <intent-filter>
        <action android:name="android.webkit.PLUGIN" />
        <data android:mimeType="application/applicationmimetype" android:scheme="http" />
    </intent-filter>
    <meta-data android:name="type" android:value="native" />            
</service>

但它似乎没有在浏览器中注册。当我在 Android 上查看 navigator.plugins 时,它要么是空的,要么只显示 Google Gears 插件。

【问题讨论】:

    标签: android mime-types browser-plugin


    【解决方案1】:

    在代码中使用 webview.getSettings().setPlugInenabled(true) 和 setJavaScript

    您可以使用 loadData(String data, String mimeType, String encoding) 设置 mime 类型

    【讨论】:

    • 我知道你是在自己的 webview 中这样做的,我说的是默认的 web 浏览器。
    • 你能举一个这样启用/禁用插件的例子吗?
    猜你喜欢
    • 1970-01-01
    • 2011-10-16
    • 2010-11-12
    • 2016-12-29
    • 1970-01-01
    • 2015-02-16
    • 2016-05-04
    • 2014-06-12
    • 2023-03-27
    相关资源
    最近更新 更多