-
Notifications
You must be signed in to change notification settings - Fork 31
/
embed.html
36 lines (33 loc) · 1.31 KB
/
embed.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<body>
<h2>Hello</h2>
<p>This is a example of how to embed browser linux in a web page using an iframe. The recommended dimensions are 750x500. See <a href="https://github.com/Darin755/browser-linux/blob/master/docs/embed.md">embedding</a> for more info.</p>
<br>
<button onclick="start()" >Start browser linux (embeded)</button>
<br>
<br>
<button onclick="sendMsg('toggleScreen')">toggle screen</button>
<button onclick="sendMsg('save')">save</button>
<button onclick="sendMsg('pause')">pause</button>
<button onclick="sendMsg('play')">run</button>
<button onclick="sendMsg('togglePause')">toggle pause</button>
<br>
<button onclick="sendMsg('cmd=pfetch')">run pfetch</button>
<button onclick="sendMsg('cmd=htop')">run htop</button>
<button onclick="sendMsg('cmd=sl')">run sl</button>
<button onclick="sendMsg('cmd=cat README')">print README</button>
<br>
<iframe id="iframe" width=750px height=500px></iframe>
<script>
// @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-2.0
//load embeded
function start() {
document.getElementById("iframe").setAttribute("src","https://darin755.github.io/browser-linux?embed=true");
}
//basic set message function
function sendMsg(msg) {
document.getElementById("iframe").contentWindow.postMessage(msg);
}
// @license-end
</script>
</body>