Object, param label and page display PDF file method

Source: Internet
Author: User

Object, param label and page display PDF file method

one, object, param label

HTML <object> Tags

Definitions and usage

Defines an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for inserting objects in an HTML document, as well as the code that can be used to display and manipulate the data.
<object> tags are used to include objects such as images, audio, video, Java applets, ActiveX, PDF, and Flash.
object is designed to replace the IMG and applet elements. This is not true, however, due to vulnerabilities and lack of browser support.
Object support for browsers depends on the object type. Unfortunately, mainstream browsers use different code to load the same object type.
Fortunately, object objects provide a solution. If the object element is not displayed, the code between <object> and </object> is executed. In this way, we are able to nest multiple object elements (each corresponding to one browser).

Instance

To add an object to the HTML code:

<object classid= "clsid:f08df954-8592-11d1-b16a-00c0f0283628" id= "Slider1" width= "height=" >
<param name= "BorderStyle" value= "1"/>
<param name= "MousePointer" value= "0"/>
<param name= "Enabled" value= "1"/>
<param name= "Min" value= "0"/>
<param name= "Max" value= "ten"/>
</object>

Browser support

Almost all major browsers have some support for <object> tags.

The difference between HTML and XHTML

NONE

Tips and Comments:

Note The:<param> label defines the run-time settings for the object.
Note: Do not use <object> labels for images, please use tags instead.

Optional Properties


Property Value Describe Dtd
Align Left Right Top bottom Defines the text alignment around the object. Tf
Archive Url A space-delimited list of URLs that point to an archive file. These files contain the resources associated with the object. STF
Border Pixels Defines a border around an object. Tf
ClassID Class ID Defines the ID value of a class embedded in a Windows Registry or a URL that can be used to specify the location of an object contained in a browser, usually a Java class. STF
CodeBase Url Defines the code needed to locate an object, providing a base URL. STF
CodeType MIME type The MIME type of the code referenced by the ClassID property. STF
Data Url Defines a URL that references object data. If you have a data file that requires object processing, use the Data property to specify the file. STF
Declare Declare You can define that this object can be declared only, but it cannot be created or illustrated until the object is applied. STF
Height Pixels Defines the height of an object. STF
Hspace Pixels Defines white space around the horizontal direction of an object. Tf
Name Unique_name Defines a unique name for an object (for use in a script). STF
Standby Text Defines the text that is displayed when an object is loading. STF
Type Mime_type Defines the MIME type of the data that appears in the file specified in the Data property. STF
Usemap Url Specify the URL of the client image map to use with the object. STF
Vspace Pixels Defines a blank for the vertical orientation of an object. Tf
Width Pixels Defines the width of an object. STF


Standard properties

ID, class, title, style, dir, Lang, Xml:lang

For a complete description, please refer to the standard properties.

Event Properties

accesskey, TabIndex, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, OnKeyDown, onkeyup

For a complete description, refer to the event properties.


Second, web-embedded multimedia Ie,mozilla, Firefox, NetScape, Opera 2
2008-09-23 14:59

(a) perfect embedded Quicktime

1, client requirements:

For Windows users and Mac OS X users, install the appropriate version of the QuickTime player. Windows version download Quicktimeinstaller.exe,mac OS X Download QuickTimeinstaller.exe

Windows users can also install storm video and other players with QuickTime decoders and browser plug-ins, such as Storm audio and video.

For Linux and users of Unix systems such as FreeBSD and Solaris, VLC Media Player and its browser plug-ins or MPlayer and their browser plug-ins are required.

2, implementation code:

<object classid= "clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" codebase= "http://www.apple.com/qtactivex/ Qtplugin.cab "width=" 420 "height=" 360 ">
<param name= "AutoPlay" value= "true"/>
<param name= "src" value= "Mov%2f%b2%e2%ca%d4%2emov"/>
<embed src= "Mov%2f%b2%e2%ca%d4%2emov" type= "Video/quicktime" autoplay= "true" width= "420" height= "360" >
</embed>
</object>


3. Main points Analysis:

QuickTime format is easy to embed, like the above to write on it, basically there is nothing to pay attention to the place. The value of the media path SRC, can be a full address, can be a relative address, can be encoded with a URL, you can not encode, QuickTime plug-ins and VLC plug-ins can be the correct support, of course, for the sake of insurance, it is best to use the URL encoding way to write media path.

Although the Video/quicktime type is specified in embed, even the linked media is mp3 still playable. Other types of QuickTime support are not tested, but I think it is possible.

(ii) perfect inline Flash

1, client requirements:

Install the Flash plugin for the browser you are using.

2, implementation code:

<object classid= "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width= "420" height= ">"
<param name= "movie" value= "flash/call to Remember. swf"/>
<param name= "Quality" value= "High"/>
<embed src= "flash/call to Remember." SWF "quality=" High "type=" Application/x-shockwave-flash "width=" 420 "height=" >< /embed>
</object>

3. Main points Analysis:

There seems to be little to say about Flash, because it's very common. Write down here just for easy access, it is dine. Oh.

(iii) allow embedded multimedia to be validated through XHTML

1, Questions:

All of the above code, although the perfect in the various browsers to play well, but there is a drawback, it is that such a page can not be validated through XHTML. The reason is that the embed tag is never a label in the HTML standard, so it is not in XHTML.

2, Solve:

If you don't care if your Web page is up to standard, do it as it is. If you want to pursue perfection, see the following solution:

The following is an example of Flash, which is also useful for other types of multimedia content.

We know that the use of the object tag is recommended by the consortium, but the usage is not Internet Explorer, which uses CLASSID to differentiate between control types, but instead uses type to specify MIME types. Now Mozilla, Firefox and Opera support this use, although the current version of IE support this use, but unfortunately, ie still has bugs, that is only the full download to play. And not all of the cases can be used. White space is also displayed on some IE browsers. Therefore, it is not enough to use the object label usage recommended by the consortium. But we can make some modifications, if the user's browser is IE, we use IE object usage, if it is the other browsers, we use the use of the consortium. So we can have both worlds. Maybe at the moment, you think we should use a script. No, we don't need a script. We only need to use IE unique conditional annotation and CSS can be done. Examples are as follows:

 

<style type= "Text/css"
. Mozilla {
Display:block;
}
</style>
<!--[if Ie]>
<style type= ' text/css '
. mozilla {
Display:none;
}
</style>
<![ endif]-->

<object
Data= "flashdatei.swf"
type= "Application/x-shockwave-flash"
height= "275"
Width= "256"
class= "Mozilla"
<param name= "AutoPlay" value= "true"
</object>
<! --[if ie]>
<object
classid= "cclsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
Width= "256"
height= " 275 ""
<param name= "src" value= "" flashdatei.swf "
</object>
<![ endif]-->

You'll find that you're actually replacing embed with object, and the position is removed from IE's object. The SRC attribute in the embed tag becomes the Data property in object. and Firefox and other non-IE browsers because do not know <!–[if ie]> tags, so the part of them as a comment ignored. IE because of the implementation of the contents of the <!–[if ie]>, the Firefox can be identified in the object because the CSS is redefined to be hidden.

How to display the PDF file directly in the Web page
2011-06-17 15:52:49

1, embed

<embed width= "height=" src= "test_pdf.pdf" > </embed>

Browsers passed: 360, Firefox, IE, Chrome

2, Object

<object classid= "clsid:ca8a9780-280d-11cf-a24d-444553540000" width= "height=" "border=" "0" > <param Name= "SRC" value= "test_pdf.pdf" > </object>

Browsers passed: 360, IE

Failed browsers: Firefox, Chrome

3. IFRAME Frame

<iframe src= "test_pdf.pdf" width= "height=" ></iframe>

Browsers passed: 360, Firefox, IE, Chrome

4, with the browser directly to access http://127.0.0.1/test_pdf.pdf (in fact, this is not in the Web)

Browsers passed: 360, Firefox, IE, Chrome

All of the above four methods are under WinXP. (before have encountered the function of upload in Win7 under the condition of failure, so here explain the OS)


Original reproduced from: http://vs.net2005.blog.163.com/blog/static/77528105201212141111959/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.