Skip to content

Commit 0db05af

Browse files
authored
Stop downloads on render (#2150)
1 parent c0e9b48 commit 0db05af

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/app/conf/2025/schedule/[id]/page.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,12 @@ export default function SessionPage({ params }: SessionProps) {
127127
<ul className="flex max-w-full flex-col gap-y-2">
128128
{session.files?.map(({ path, name }) => (
129129
<li key={path}>
130-
<iframe
131-
src={path}
132-
className="aspect-video size-full"
133-
/>
130+
{path.endsWith(".pdf") && canRenderPdf() ? (
131+
<iframe
132+
src={path}
133+
className="aspect-video size-full"
134+
/>
135+
) : null}
134136
<div className="flex items-stretch justify-between overflow-hidden">
135137
<a
136138
className="typography-link flex items-center truncate p-3 leading-none text-neu-700 max-xs:hidden sm:px-6"
@@ -295,3 +297,9 @@ function SessionDescription({ session }: { session: ScheduleSession }) {
295297
</div>
296298
)
297299
}
300+
301+
const isFirefox = navigator.userAgent.toLowerCase().includes("firefox")
302+
303+
function canRenderPdf() {
304+
return !isFirefox && !!navigator?.mimeTypes?.["application/pdf" as any]
305+
}

0 commit comments

Comments
 (0)