Create htmlrunner.html
Browse files- htmlrunner.html +57 -0
htmlrunner.html
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Just A Test</title>
|
5 |
+
<style>
|
6 |
+
body: {
|
7 |
+
background-color: white;
|
8 |
+
}
|
9 |
+
</style>
|
10 |
+
<script>
|
11 |
+
function handleFileSelect(event) {
|
12 |
+
const file = event.target.files[0];
|
13 |
+
const reader = new FileReader();
|
14 |
+
|
15 |
+
reader.onload = function(e) {
|
16 |
+
const htmlContent = e.target.result;
|
17 |
+
const iframe = document.getElementById('output');
|
18 |
+
iframe.srcdoc = htmlContent;
|
19 |
+
};
|
20 |
+
|
21 |
+
reader.readAsText(file);
|
22 |
+
}
|
23 |
+
</script>
|
24 |
+
</head>
|
25 |
+
<body>
|
26 |
+
<h1>Upload and Run HTML File</h1>
|
27 |
+
<p>
|
28 |
+
(If it isn't working press TAB)
|
29 |
+
</p>
|
30 |
+
<input type="file" accept=".html" onchange="handleFileSelect(event)">
|
31 |
+
<br>
|
32 |
+
<iframe id="output" width="100%" height="1000px"></iframe>
|
33 |
+
</body>
|
34 |
+
<script>
|
35 |
+
document.querySelector('#fileInput').addEventListener('change', handleFile,false)
|
36 |
+
|
37 |
+
function handleFile(e){
|
38 |
+
var reader = new FileReader;
|
39 |
+
var file = e.target.files[0]
|
40 |
+
|
41 |
+
reader.onload = function(e){
|
42 |
+
var csv = e.target.result
|
43 |
+
|
44 |
+
// execute chart code in here with
|
45 |
+
// "csv":{
|
46 |
+
// "data-string": csv,
|
47 |
+
// ...
|
48 |
+
// }
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
reader.readAsText(file);
|
53 |
+
}
|
54 |
+
</script>
|
55 |
+
</html>
|
56 |
+
|
57 |
+
|