문제

I want to display pdf file view in a division on a webpage for reading. I was using iframe for that. But as i searched about it. iframe is deprecated in html5.

Any other compatible(non flash and if possible not html5) way to show pdf content on webpage just like a pdf displayed with an iframe?

도움이 되었습니까?

해결책

The <iframe> is not deprecated at all. At least, the current HTML5 spec draft on <iframe> doesn't say anything about deprecation. In the future please read the specification itself before making ungrounded assumptions.

There's however an alternative to the <iframe> which allows graceful degradation: the <object> tag which in the below example gracefully degrades to a link when the specified content type is not supported by the browser nor any of its plugins (you know, displaying a PDF file inline requires the Acrobat Reader plugin).

<object data="/url/to/file.pdf" type="application/pdf" width="500" height="300">
    <a href="/url/to/file.pdf">Download file.pdf</a>
</object>

다른 팁

This is a perfectly acceptable use of an iframe. It has not been deprecated in HTML5, it even has three new tags (sandbox, seamless, and srcdoc). Or you can use <object> as the other answer suggests.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top