2015-10-15 120 views
-1

我试图在iframe中自动运行Setup.exe。iframe中的自动执行.exe

一旦网站访问者变成客户面板注册后弹出一个Java窗口运行setup.exe

该软件将被执行将是我的客户,谁是问服务台的远程访问程序。

所以我试图做一个与客户端的形状直接从页面运行我的可执行文件,而无需下载。

见的,我怎么做的一个例子:

main.js

var btnTitleChange = $.button("Let\'s change Frame title") 
    .on_click(changeTitle,"Wow, I changed!"); 

var frame = $.frame("Demo Application") 
    .layout($.layout("table",[[20,-1,20],[20,40,10,-1,20]])) 
    .add($.button("About").on_click(alert),"1,1") 
    .add(btnTitleChange,"1,3"); 

frame.show(); 

function changeTitle(title){frame.title(title);} 

function alert(){ 
    js.alert("Welcome to JavaScript executable!"); }; 

包括/ java.js

importPackage(Packages.java.lang) 
importPackage(Packages.java.awt) 
importPackage(Packages.java.awt.event) 
importPackage(Packages.javax.swing) 
importPackage(Packages.info.clearthought.layout); 

//============================= START OF CLASS ==============================// 
//CLASS: java_object               // 
//===========================================================================// 
/** 
    * A reference to the Java Object class 
    * @class 
    */ 
java_object = function(inst){ 
    /** 
    * Data container for this object 
    * @private 
    */ 
    this._d = {} 
    /** 
    * Contains the actual Java instance for this object 
    * To access it use the <b>instance()</b> method 
    * @private 
    */ 
    this._inst = new java.lang.Object();  
    this.instance = function(){return this._inst;} 
    this.equals = function(o){return (undefined===o._inst)?false:this._inst.equals(o.instance());} 
    this.getClass = function(){return this.instance().getClass();} 
    this.hashCode = function(){return this.instance().hashCode();} 
    this.toString = function(){return this.instance().toString();} 
}; 
//===========================================================================// 
//CLASS: java_object               // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: java_component              // 
//===========================================================================// 
/** 
    * A reference to the Java Component class 
    * @augments java_object 
    * @class 
    */ 
java_component = function(){ 
    this._inst = null; 
    //========================= START OF METHOD ===========================// 
    // METHOD: on_click             // 
    //=====================================================================// 
     /** 
     * Sets a function to be executed, when the mouse is clicked over this 
     * widget 
     * @param title the title to be shown in the frame 
     * @type mixed 
     */ 
    this.on_click=function(fn,arg1,arg2,arg3){ 
     var adapter = new java.awt.event.MouseAdapter() { mousePressed: function(e){fn(arg1,arg2,arg3);} };   
     this.instance().addMouseListener(adapter); 
     return this; 
    }; 
    //=====================================================================// 
    // METHOD: on_click             // 
    //========================== END OF METHOD ============================// 
}; 
java_component.prototype = new java_object(); 
java_component.constructor == java_object; 
//===========================================================================// 
//CLASS: java_component              // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: java_container               // 
//===========================================================================// 
/** 
    * A reference to the Java Container class 
    * @augments java_component 
    * @class 
    */ 
java_container = function(){ 
    this._inst = new java.awt.Container(); 
    //========================= START OF METHOD ===========================// 
    // METHOD: add              // 
    //=====================================================================// 
     /** 
     * Adds an object to the container. 
     * @type void 
     */ 
    this.add=function(object,constraints){ 
     if(undefined==constraints){ 
      (undefined===object.instance)?this.instance().add(object):this.instance().add(object.instance()); 
     }else{ 
      if(constraints.toUpperCase()=="NORTH"){ 
       (undefined===object.instance)?this.instance().add(object,BorderLayout.NORTH):this.instance().add(object.instance(),BorderLayout.NORTH); 
      }else if(constraints.toUpperCase()=="SOUTH"){ 
       (undefined===object.instance)?this.instance().add(object,BorderLayout.SOUTH):this.instance().add(object.instance(),BorderLayout.SOUTH); 
      }else if(constraints.toUpperCase()=="EAST"){ 
       (undefined===object.instance)?this.instance().add(object,BorderLayout.EAST):this.instance().add(object.instance(),BorderLayout.EAST); 
      }else if(constraints.toUpperCase()=="WEST"){ 
       (undefined===object.instance)?this.instance().add(object,BorderLayout.WEST):this.instance().add(object.instance(),BorderLayout.WEST); 
      }else{ 
       (undefined===object.instance)?this.instance().add(object,constraints):this.instance().add(object.instance(),constraints); 
      } 
     } 
     return this; 
    }; 
    //=====================================================================// 
    // METHOD: add              // 
    //========================== END OF METHOD ============================// 

    //========================= START OF METHOD ===========================// 
    // METHOD: layout              // 
    //=====================================================================// 
     /** 
     * Sets the layout for this container. 
     * @type void 
     */ 
    this.layout = function(layout){ 
     (undefined===layout.instance)?this.instance().setLayout(layout):this.instance().setLayout(layout.instance()); 
     return this; 
    }; 
    //=====================================================================// 
    // METHOD: layout              // 
    //========================== END OF METHOD ============================// 

    return this; 
} 
java_container.prototype = new java_component(); 
java_container.constructor == java_component; 
//===========================================================================// 
//CLASS: j_container               // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: java_frame               // 
//===========================================================================// 
/** 
    * A reference to the Java Window class 
    * @class 
    */ 
java_frame = function(title){ 
    this._inst = (undefined===title)?new javax.swing.JFrame(""):new javax.swing.JFrame(title); 
    this._inst.setSize(600,400);  
    this._inst.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 

    //========================= START OF METHOD ===========================// 
    // METHOD: show              // 
    //=====================================================================// 
    this.show=function(){this._inst.setVisible(true);}; 
    //=====================================================================// 
    // METHOD: show              // 
    //========================== END OF METHOD ============================// 

    //========================= START OF METHOD ===========================// 
    // METHOD: close              // 
    //=====================================================================// 
    this.close=function(){this._inst.setVisible(false);}; 
    //=====================================================================// 
    // METHOD: close              // 
    //========================== END OF METHOD ============================// 

    //========================= START OF METHOD ===========================// 
    // METHOD: on_close             // 
    //=====================================================================// 
     /** 
     * Sets or retrieves the title of this frame. 
     * @param title the title to be shown in the frame 
     * @type mixed 
     */ 
    this.on_close=function(fn,arg1,arg2,arg3){ 
     var adapter = new java.awt.event.WindowAdapter() { windowClosing: function(e){fn(arg1,arg2,arg3);} }; 
     this.instance().addWindowListener(adapter); 
     return this; 
    }; 
    //=====================================================================// 
    // METHOD: on_close             // 
    //========================== END OF METHOD ============================// 

    //========================= START OF METHOD ===========================// 
    // METHOD: title              // 
    //=====================================================================// 
     /** 
     * Sets or retrieves the title of this frame. 
     * @param title the title to be shown in the frame 
     * @type mixed 
     */ 
    this.title=function(/**String*/title){ 
     if(undefined===title)return this.instance().getTitle(); 
     else{this.instance().setTitle(title);} 
     return this; 
    }; 
    //=====================================================================// 
    // METHOD: title              // 
    //========================== END OF METHOD ============================// 
    return this; 
} 
java_frame.prototype = new java_container(); 
java_frame.constructor == java_container; 
//===========================================================================// 
//CLASS: j_frame                // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: j_layout               // 
//===========================================================================// 
/** 
* A reference to the Java Container class 
* @augments j_object 
* @class 
*/ 
java_layout = function(type,constraints){ 
    if(type==="border")this._inst = new java.awt.BorderLayout(); 
    if(type==="flow")this._inst = new java.awt.FlowLayout(); 
    if(type==="table"){ 
     this._inst = new TableLayout(constraints); 
    } 
    return this; 
} 
java_layout.prototype = new java_object(); 
//===========================================================================// 
//CLASS: j.layout               // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: j_button               // 
//===========================================================================// 
/** 
    * A reference to the Java JButton class 
    * <div style="position: relative; top: 10px; left: 10px; font-size: 11px; font-family: verdana; color:crimson;">&nbsp;Example&nbsp;</div> 
    * <div style="border: 1px dashed silver; margin: 10px; padding: 5px; background: cornsilk; font-family: monospace; font-size: 12px;"> 
    * var button = new j_button();<br> 
    *  button.text("Click me");<br> 
    *  button.on_click(js.alert,"I was clicked"); 
    * </div> 
    * @augments j_component 
    * @class  
    */ 
java_button = function(text){ 
    this._inst = (undefined===text)?new javax.swing.JButton(""):new javax.swing.JButton(text); 
    //========================= START OF METHOD ===========================// 
    // METHOD: text              // 
    //=====================================================================// 
    this.text=function(text){ 
     if(undefined===text){return this.instance().getText();} 
     this.instance().setText(text); 
    }; 
    //=====================================================================// 
    // METHOD: text              // 
    //========================== END OF METHOD ============================// 
    return this; 
} 
java_button.prototype = new java_component(); 
//===========================================================================// 
//CLASS: java_button               // 
//============================== END OF CLASS ===============================// 

//============================= START OF CLASS ==============================// 
//CLASS: namespace               // 
//===========================================================================// 
/** @namespace */ 
$ = { 
    _button:java_button, 
    _frame:java_frame, 
    _layout:java_layout, 
    _object:java_object, 
    button:function(name){ 
     return new this._button(name); 
    }, 
    frame:function(title){ 
     return new this._frame(title); 
    }, 
    layout:function(name,constraints){ 
     return new this._layout(name,constraints); 
    }, 
    object:function(){ 
     return new this._object(); 
    } 
}; 
//===========================================================================// 
//CLASS: namespace               // 
//============================== END OF CLASS ===============================// 

包括/ js.js

/** @namespace */ 
js = { 
    _loaded:[], // Reference to all the loaded script files 
    alert:function(msg){ 
     JOptionPane.showMessageDialog(null, "<html><font size=\"3\" color=\"red\">"+msg+"</font></html>", "Alert",JOptionPane.WARNING_MESSAGE); 
    }, 
    echo:function(msg){System.out.print(msg);}, 
    getcwd:function(){ 
     return System.getProperty("user.dir"); 
    }, 
    include:function(path){ 
     var id = path.split("\\").join("_").split(" ").join("___"); 
     if(undefined === this._loaded[id]){this._loaded[id]=id;} 
     load(path.split("\\").join("/")); 
    }, 
    include_once:function(path){ 
     var id = path.split("\\").join("_").split(" ").join("___"); 
     if(undefined === this._loaded[id]){ 
      this._loaded[id]=id; load(path.split("\\").join("/")); 
     } 
    }, 
    version:1.2 
} 
js.include("includes/java.js"); 

我想在图片链接保持如图所示:

如果任何人都可以准备给我的是iframe准备好,所以我可以学习更多关于它,并能够实践。

回答

0

您可以使用Java小程序来显示您的Java应用程序。但现代浏览器(如Google Chrome,Microsoft Edge和Mozilla Firefox即将推出)终止了对插件NPAPI的支持,如Adobe Flash和Java Plugin。

所以,Java小程序已经过时并且非常不安全。

但如果你想这样做,Oracle建议使用IE或Safari。

请参见官方页面:https://java.com/en/download/faq/chrome.xml

+0

的答复非常感谢。 Sera有另一种解决方案,我可以设法做到这一点? – Seth

+0

我不知道你的理由,但对我来说这是不切实际的。 –

+0

我在帮助台网站 我们创建了一个远程访问系统。 客户区要求您下载并安装.msi文件 许多低和客户不知道运行。 因此,我经常不得不在客户的房子去执行 它最终给了我很多工作。 所以我试图做到这一点 为了方便,我不想做任何违法的事情。 因此,我可以看到我是否可以找到一个解决方案,我不会去客户。他们中的许多人生活得很远,很少有人了解它,无法找到要运行的文件。 但我理解你在伦理方面的问题。 但只是想同样的方便。对我来说 – Seth