web-common-resource/terminal/vmks/terminal.html

39 lines
1.4 KiB
HTML
Raw Permalink Normal View History

2024-08-20 12:11:35 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vmware remote console</title>
</head>
<body>
<link rel="stylesheet" type="text/css" href="./wmks-all.css" />
<script type="text/javascript" src="./vmksJq.js"></script>
<script type="text/javascript" src="./vmkaJqUi.js"></script>
<script type="text/javascript" src="./wmks.min.js"></script>
<div>
<button id="button">发送Ctrl+Alt+Delete</button>
<button id="button1">查看全屏</button>
</div>
<div id="wmksContainer" style="position:absolute;width:100%;height:100%">
</div>
<script>
var item = JSON.parse(sessionStorage.getItem('console'));
var url = 'wss://' + location.host + '/api/terminal/ticket/' + item.ticket + '?real_host=' + item.host;
var wmks = WMKS.createWMKS("wmksContainer", {}).register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, function(event, data) {
if (data.state == WMKS.CONST.ConnectionState.CONNECTED) {
console.log("连接状态改变:连接");
}
});
wmks.connect(url);
var btn = document.getElementById('button');
btn.onclick = function() {
wmks.sendKeyCodes([17, 18, 46])
}
document.getElementById('button1').onclick = function() {
wmks.enterFullScreen();
}
</script>
</body>
</html>