2013-05-08 133 views
0

我的web應用程序(localhost:8083/myapp)在服務器端使用Java,在客戶端使用ExtJS 4.1.3,瀏覽器爲Google Chrome。
通過點擊我的web應用程序中的按鈕,我想用ActiveX對象打開新窗口。
我安裝了Neptune插件(http://www.meadroid.com/neptune/about.htm),它可以在Google Chrome中啓用ActiveX。我無法使用像IETab這樣的Chrome擴展程序,因爲它們會破壞我的標記,並且我不想在IE下加載整個應用程序。
手動安裝插件:將npmeadax.dll複製到C:\ Documents and Settings \ User_name \ Local Settings \ Application Data \ Google \ Chrome \ User Data \ Default \ Plugin Data,將其註冊到regsvr32.exe npmeadax.dll並重新打開谷歌瀏覽器。 注意:使用安裝程序自定義安裝後,npmeadax.dll可用。
插件只需要將embed標籤添加到屬性type ='application/x-meadco-neptune-ax'和屬性param-location設置爲location.href的頁面中。
問題是當我使用純HTML頁面時,ActiveX對象工作,但在Web應用程序中使用相同的代碼時不起作用。在純HTML頁面中,當我調試loadPage函數時,在窗口頂部出現tbody.appendChild(嵌入)信息欄並說:「爲了幫助保護您的安全,Internet Explorer限制此文件顯示可訪問您的活動內容電腦。點擊這裏查看選項。「我允許阻止內容,並且所有內容都按預期工作:字詞文件以字符串'Hello world!'打開。添加。但在Web應用程序中,activeX未激活。 /myapp//js/app/controller/somepackage/embed.html是相同的爲C:\ embed.html
這裏是普通的HTML頁面中的代碼:
C:\ button.html使用Neptune插件的Chrome在ExtJs應用程序中ActiveX不起作用

<html> 
<head> 
</head> 

<body> 
    <input type="button" value="open win" onclick="window.open('embed.html','_blank')" /> 
</body> 
</html> 

C:\ embed.html

<html> 
<head> 
    <script type="text/javascript"> 
     function loadPage() { 
      var lh = location.href; 
      var embed = document.createElement('embed'); 
      embed.setAttribute('width','100%'); 
      embed.setAttribute('height','100%'); 
      embed.setAttribute('type','application/x-meadco-neptune-ax'); 
      embed.setAttribute('param-location',lh); 
      var tbody = document.getElementsByTagName('body')[0]; 
      tbody.appendChild(embed);     
      try { 
       var w = new ActiveXObject('Word.Application'); 
       var docText; 
       var obj; 
       if (w != null) 
       { 
        w.Visible = true; //set to false to stop the Word document from opening 
        obj = w.Documents.Open("C:\\A.doc"); 
        docText = obj.Content; 
        w.Selection.TypeText("Hello world!"); 
        w.Documents.Save(); 
       } 
      } 
      catch(e) {} 
     } 
    </script> 
</head> 

<body onload="loadPage()"> 
</body> 
</html> 

這裏是web應用程序中的代碼:
SomeForm.js(ExtJs的控制器):

Ext.define("App.controller.somepackage.SomeForm", { 
extend : 'Ext.app.Controller', 
... 
init: function() { 
    this.application.on('click_button', this.onButtonClick, this); 
    ... 
},  
onButtonClick: function() { 
    var win = window.open("/myapp//js/app/controller/somepackage/embed.html","_blank");   
} 
... 

UPDATE:
在JavaScript中添加純HTML頁面嵌入標籤 樣子:

<embed width="100%" height="100%" type="application/x-meadco-neptune-ax" param-location="file:///C:/embed.html"> 

在網絡應用程序中嵌入標籤的樣子:

<embed width="100%" height="100%" type="application/x-meadco-neptune-ax" param-location="http://localhost:8083/myapp//js/app/controller/somepackage/embed.html"> 

回答

0

看來,海王星使用當前版本設置的IE,它安裝在操作系統中。我使用IE8,所以我配置了安全設置,一切正常 - 我有一個對話窗口詢問ActiveX組件的安全性。我有一個本地化版本的IE,所以我很抱歉,如果我命名錯誤。以下是IE中的操作:
1.選擇服務 - >資源管理器設置 - >選項卡「安全」。
2.選擇「本地Intranet」。點擊Nodes,然後點擊Additional。添加

http://localhost 

單擊添加,關閉,然後ОК。
3.選擇另一個...
4。對於「的ActiveX元件和連接模塊」:
的ActiveX管理要素的自動請求 - 在
運行ActiveX元素的腳本標記爲安全 - 對
加載未簽名的ActiveX元素 - 建議
加載已簽名的ActiveX元素 - 建議
運行ActiveX元件和連接模塊 - 基於ActiveX的元素
使用未標記爲可安全使用 - 建議的二進制代碼和腳本
行動 - 對
允許使用的ActiveX沒有要求只斷言域 - 關
允許運行之前沒有使用警告的ActiveX管理元素 - 在
允許腳本 - 在

之後,我重新打開Goog​​le Chrome。

相關問題