Debian Codegraph @

www/static/test/manual/hx-preload/index.html

raw symbols SCIP
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="UTF-8">
5 <title>hx-preload Test</title>
6 <meta name="htmx-config" content='{"selfRequestsOnly":false}'>
7 <script src="../../../src/htmx.js"></script>
8 <script src="../../../src/ext/hx-preload.js"></script>
9 <style>
10 body { font-family: sans-serif; max-width: 600px; margin: 2em auto; }
11 .card { border: 1px solid #ccc; padding: 1em; margin: 1em 0; border-radius: 4px; }
12 a { color: #07c; }
13 code { background: #f0f0f0; padding: 0.2em 0.4em; border-radius: 3px; }
14 #output { min-height: 50px; border: 1px dashed #aaa; padding: 1em; margin-top: 0.5em; }
15 </style>
16 </head>
17 <body>
18
19 <h1>hx-preload Manual Test</h1>
20 <p>Open the Network tab in DevTools to observe preload fetch requests.</p>
21
22 <div class="card">
23 <h3>1. Preload on mousedown (default for boosted links)</h3>
24 <p>Boosted links preload automatically on <code>mousedown</code>. Press and hold to see the prefetch, then release to navigate.</p>
25 <a hx-boost="true" href="page2.html">Go to Page 2 (boosted)</a>
26 </div>
27
28 <div class="card">
29 <h3>2. Preload on mouseover</h3>
30 <p>Hover over the link to trigger a preload.</p>
31 <a hx-get="page2.html" hx-target="#output" hx-preload="mouseover">
32 Hover to preload, click to swap
33 </a>
34 <div id="output">Response will appear here</div>
35 </div>
36
37 <div class="card">
38 <h3>3. Preload on mousedown (explicit)</h3>
39 <button hx-get="fragment.html" hx-target="#output2" hx-preload="mousedown">
40 Press &amp; release to load
41 </button>
42 <div id="output2">Response will appear here</div>
43 </div>
44
45 </body>
46 </html>