[英]How to enable ActiveX controls not marked as safe using javascript code for IE, while reading XLS/XLSX local files
[英]How to enable “initialize and script activex controls not marked as safe for scripting(ActiveXObject)” in IE automatically through js or batch file
根據我的要求,我需要在IE中使用ActiveXObject實現一個文件系統 。 我實現了相同但困難的是要求用戶從Internet選項手動啟用“初始化和腳本activex控件未標記為可安全編寫腳本”選項。 所以任何人都可以建議我如何通過編碼(Javascript或批處理)啟用相同的功能。
不是答案或解決方案,只是基於類似領域的簡要經驗的一些指導。 IE-11不允許直接使用ActiveX對象,除非你提到的IE安全設置降低了。 改為開發插件並讓用戶安裝此插件作為使用您的應用程序的先決條件。
或者,這里有一種方法可以嘗試在javascript中再次實例化ActiveX對象但是這可能需要手動設置IE設置以允許調用ActiveX或運行此javascript。 您可能需要對此進行測試。
xx
try { var shellObj = new ActiveXObject("WScript.Shell"); var clsid = "xxxxxxxx-xxxx-xxxx-xxxx-000000000000"; var progid = shellObj.RegRead("HKEY_CLASSES_ROOT\\\\CLSID\\\\{" + clsid + "}\\\\ProgID\\\\"); var plugin = new ActiveXObject(progid); if (plugin) { //whatever you want to achieve } else { return null; } }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.