`embed` tag causing odd behavior
Answered
Bridled Titmouse posted this in #help-forum
Bridled TitmouseOP
I am using nextjs 14.2.3 with app router. I have a route segment of /reports/[id]/page.tsx. and when i try to use the html tag in this page to render a pdf like this
The route renders the entire app again inside this page, including the root layout and my route layout, and it doesn't embed the pdf ... ¯\_(ツ)_/¯.
if I remove the <embed> tag and use something else - it rendered correctly.
basically, the app just doesn't work when I use the <embed> tag - does anyone know why or experience it?
<embed
type="application/pdf"
src="sample.pdf"
width="640"
height="480"
/>The route renders the entire app again inside this page, including the root layout and my route layout, and it doesn't embed the pdf ... ¯\_(ツ)_/¯.
if I remove the <embed> tag and use something else - it rendered correctly.
basically, the app just doesn't work when I use the <embed> tag - does anyone know why or experience it?
Answered by joulev
does it work if you use this?
where the src is an absolute path
<embed
type="application/pdf"
src="/sample.pdf"
width="640"
height="480"
/>where the src is an absolute path
3 Replies
@Bridled Titmouse I am using nextjs 14.2.3 with app router. I have a route segment of /reports/[id]/page.tsx. and when i try to use the html tag in this page to render a pdf like this
`<embed
type="application/pdf"
src="sample.pdf"
width="640"
height="480"
/>`
The route renders the entire app again inside this page, including the root layout and my route layout, and it doesn't embed the pdf ... ¯\_(ツ)_/¯.
if I remove the <embed> tag and use something else - it rendered correctly.
basically, the app just doesn't work when I use the <embed> tag - does anyone know why or experience it?
does it work if you use this?
where the src is an absolute path
<embed
type="application/pdf"
src="/sample.pdf"
width="640"
height="480"
/>where the src is an absolute path
Answer
Bridled TitmouseOP
i'll test
oh man - i feel dumb! that does work thanks @joulev