JavaWebStart:如何修复deployjava.js以忽略Chrome42并假设已安装java

4bbkushb  于 2021-07-13  发布在  Java
关注(0)|答案(1)|浏览(315)

我已经阅读了有关chrome42的可用信息,我希望解决这个问题,以便允许用户在使用chrome42时下载我的jnlp文件。
问题是,如何修补deployjava.js来为我做到这一点?
编辑:这是我当前的用法:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My Applications</title>
<link rel="shortcut icon" href="my_icon.ico" />
<style type="text/css">
</style>
</head>

<body>
<script src="deployJava.js"></script>
<script>
    if (deployJava.versionCheck('1.7.0+') == false) {                   
        userInput = confirm(
            "Need latest Java(TM) Runtime Environment.\n\n"+ 
            "If Java is already installed, please cancel this message, allow Java in the status bar, "+
            "and refresh the page.\n\n"+ 
            "If Java is not installed, please select 'OK' to be redirected to the Java installation page.");            
        if (userInput == true) {  

            // Set deployJava.returnPage to make sure user comes back to 
            // your web site after installing the JRE
            deployJava.returnPage = location.href;

            // Install latest JRE or redirect user to another page to get JRE
            deployJava.installLatestJRE(); 
        }
    }
</script>  

<div class="back" align="center">
  <div class="centerdiv">
    <div class="ButtonsDIv">
    <script src="deployJava.js"></script>
    <script>        
        var url = location.protocol+'//'+location.hostname+(location.port ? ':'+location.port: '')+'/my_jnlp.jnlp';
        deployJava.launchButtonPNG='button.png'
        deployJava.createWebStartLaunchButton(url, '1.7.0');
    </script>
    <noscript>
      <a href="my_jnlp.jnlp">Launch My Application</a>
    </noscript>
    </div>
  </div>
</div>
</body>
</html>
kmb7vmvb

kmb7vmvb1#

如果您想让用户下载您的jnlp文件,然后在本地运行它(假设您已经安装了java),那么为什么不使用简单的html链接呢?

<a href="my-webstart-app.jnlp">Download</a>

上面的代码将下载jnlp,然后通过双击该文件在java中运行。

相关问题