summaryrefslogtreecommitdiff
path: root/demo/main.html
diff options
context:
space:
mode:
authorJoel Stålnacke <joel@saker.fi>2026-03-19 11:39:15 +0200
committerJoel Stålnacke <joel@saker.fi>2026-03-19 11:39:49 +0200
commita22dfee999685cdfd4d9b20c74d0a41105de45e1 (patch)
treea13ac4274ded0c05f4a1df0438598541742c8d99 /demo/main.html
Add demoHEADmain
Diffstat (limited to 'demo/main.html')
-rw-r--r--demo/main.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/demo/main.html b/demo/main.html
new file mode 100644
index 0000000..47f2c7a
--- /dev/null
+++ b/demo/main.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>Document viewer</title>
+ <style>
+ .viewer {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ margin: 0 auto;
+ max-width: 60rem;
+ }
+
+ .viewer_frame {
+ width: 100%;
+ }
+ </style>
+</head>
+
+<body>
+ <main>
+ <h1>
+ Document viewer
+ </h1>
+ <button id="print-button">Print</button>
+ <section class="viewer">
+ <iframe id="frame" class="viewer_frame" src="page.html"></iframe>
+ </section>
+ </main>
+ <script>
+ document.getElementById("print-button").onclick = (e) => {
+ let frame = document.getElementById("frame");
+ frame.contentWindow.postMessage("print", "*");
+ };
+ </script>
+</body>
+
+</html>