2015-04-28 31 views
4

我已閱讀了關於Chrome 42的可用信息,並且我正在尋找解決該問題以便允許用戶下載我的jnlp文件從鉻42工作時。Java WebStart:如何解決deployJava.js忽略Chrome 42並假設安裝了java

問題是,我如何補丁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> 

回答

0

如果你想讓用戶下載您的JNLP文件,然後運行它在本地假設你安裝了Java,那麼爲什麼不直接使用簡單的HTML鏈接?

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

以上將下載jnlp,然後雙擊該文件即可在Java中運行。

+1

因爲我希望該功能可以在IE,Firefox和舊版Chromes上運行。 我只想檢測Chrome v42及更高版本(或者所有Chromes,如果這是不可能的),並繞過該機制。 – Shloim

+1

您可以在這裏使用javascript代碼檢查chrome及其版本:http://stackoverflow.com/questions/4900436/detect-version-of-chrome-installed –