嵌入与对象 [英] EMBED vs. OBJECT

查看:114
本文介绍了嵌入与对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想要显示Adobe PDF查看器时,在我的HTML文件中使用哪个正确/最佳标记?现在我正在使用下面的代码,但有一些奇怪的副作用(例如,它似乎窃取了我已经设置到另一个INPUT文本框的起始焦点;它似乎并不能很好地与jQueryUI Resizeable类一起玩)等等)

 < embed src =abc.pdftype =application / pdf/> 

我甚至可以用OBJECT标记做同样的事情吗?使用一个标签与另一个标签是否有优势/劣势? 解决方案

之前,像 object 之类的东西都在 w3c 介意。



这就是

<$ p $ p> < object data =data / test.pdftype =application / pdfwidth =300height =200>
alt:< a href =data / test.pdf> test.pdf< / a>
< / object>

如果您确实需要几乎所有浏览器中显示的内联PDF,因为旧版浏览器可以理解嵌入但不是 object ,您需要这样做:

 < object data =abc.pdftype =application / pdf> 
< embed src =abc.pdftype =application / pdf/>
< / object>

此版本未验证

Which is the right/best tag to use in my HTML file when I want to display the Adobe PDF viewer? Right now I'm using the code below, but there are weird side effects (e.g. it seems to steal the starting focus that I've set to another INPUT text box; it doesn't seem to play real well with the jQueryUI Resizeable class; etc.)

<embed src="abc.pdf" type="application/pdf" />

Could I even do the same thing with the OBJECT tag? Are there advantages/disadvantages to using one tag vs. the other?

OBJECT vs. EMBED - why not always use embed?

Bottom line: OBJECT is Good, EMBED is Old. Beside's IE's PARAM tags, any content between OBJECT tags will get rendered if the browser doesn't support OBJECT's referred plugin, and apparently, the content gets http requested regardless if it gets rendered or not.

object is the current standard tag to embed something on a page. embed was included by Netscape (along img) before anything like object were on the w3c mind.

This is how you include a PDF with object:

<object data="data/test.pdf" type="application/pdf" width="300" height="200">
  alt : <a href="data/test.pdf">test.pdf</a>
</object>

If you really need the inline PDF to show in almost every browser, as older browsers understand embed but not object, you'll need to do this:

<object data="abc.pdf" type="application/pdf">
    <embed src="abc.pdf" type="application/pdf" />
</object>

This version does not validate.

这篇关于嵌入与对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆