【问题标题】:How to force firefox to open page with java web start?java - 如何强制firefox使用java web start打开页面?
【发布时间】:2012-04-20 17:38:07
【问题描述】:

我有一个存储箱管理页面,应该使用 Java Web Start 打开。但是,在我的 MacBook 上的所有浏览器上,这不会发生,而是我只得到一个保存有内容的 html 页面:“v6.3.1a Web Tools 10.1.18.222”。

查看页面的 javascript 代码,我看到它正在尝试检测是否安装了正确的 Java Web Start:

function webstartVersionCheck(versionString) {
        // Mozilla may not recognize new plugins without this refresh
    navigator.plugins.refresh(true);
    // First, determine if Web Start is available
    if **(navigator.mimeTypes['application/x-java-jnlp-file'])** {
        // Next, check for appropriate version family
        for (var i = 0; i < navigator.mimeTypes.length; ++i) {
                pluginType = navigator.mimeTypes[i].type;
            if (pluginType == "application/x-java-applet;version=" + versionString) {
                return true;
            }
        }
    }
    return false;
}

这里称为:

function writeMozillaData(page) {
        versionCheck = webstartVersionCheck("1.5");
    if (!versionCheck) {
        var pluginPage = "http://jdl.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=java.com";
        document.write("The version of Java plugin needed to run the application is not installed. The page from where the plugin can be downloaded will be opened in a new window. If not, please click here: <a href=" + pluginPage + ">Download correct Java version.</a>");
        window.open(pluginPage, "needdownload");
    } else {
        window.location = page;
    }
}

我在 mimeTypes 中添加了一个警报,并注意到导航器中没有显示“application/x-java-jnlp-file”的 mimeType。

问题:

  1. 这是导致浏览器将内容解释为文本/html 并保存 html 的原因吗?
  2. 如何在此处强制启动 Java Web Start?

我确实有 firefox 设置表明 jnlp 由 Java Web Start 应用程序处理,因此我怀疑浏览器根本没有将页面解释为 jnlp。

【问题讨论】:

    标签: java mime-types content-type jnlp


    【解决方案1】:

    ..在导航器中没有显示application/x-java-jnlp-file 的 mimeType。

    这是导致浏览器将内容解释为 text/html 并保存 html 的原因吗?

    几乎肯定是的。修复内容类型。

    【讨论】:

      猜你喜欢
      • 2020-10-07
      • 2017-12-12
      • 2012-08-17
      • 2013-11-03
      • 2019-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-15
      相关资源
      最近更新 更多