diff options
Diffstat (limited to 'examples/non-html-pages/src/pages/index.astro')
-rw-r--r-- | examples/non-html-pages/src/pages/index.astro | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/non-html-pages/src/pages/index.astro b/examples/non-html-pages/src/pages/index.astro index 18fe9b9da..921400acd 100644 --- a/examples/non-html-pages/src/pages/index.astro +++ b/examples/non-html-pages/src/pages/index.astro @@ -12,9 +12,11 @@ // can fetch them directly in the browser. const response = await fetch(`/about.json`); const data = await response.json(); - document.getElementById( - 'result' - ).innerHTML = `Load complete!<br/>Built with: <a href="${data.url}">${data.name}!</a>`; + const resultHeader = document.getElementById('result'); + + if (resultHeader) { + resultHeader.innerHTML = `Load complete!<br/>Built with: <a href="${data.url}">${data.name}!</a>`; + } </script> </body> </html> |