--- | |
import LoadingComponent from "@components/Loading.astro"; | |
import Layout from "@layouts/Layout.astro"; | |
--- | |
<Layout title="Loading page..." noHeader="true"> | |
<LoadingComponent /> | |
</Layout> | |
<script> | |
import { pageLoad } from "@utils/events"; | |
import { navigate } from "astro:transitions/client"; | |
function isComingFromIframe() { | |
try { | |
return window.self !== window.top; | |
} | |
catch (e) { | |
return true; | |
} | |
} | |
pageLoad(() => { | |
const isIframe = isComingFromIframe(); | |
if (!isIframe) { | |
console.log("Assuming request isn't coming from iFrame. Redirecting..."); | |
navigate('/'); | |
} | |
}); | |
</script> | |