Home arrow JavaScript arrow Page 6 - JavaScript and Embedded Objects
JAVASCRIPT

JavaScript and Embedded Objects


There's more to Web browsers than (X)HTML, CSS, and JavaScript. ActiveX, plug-ins, and other embedded objects help make the Web what it is today. Get the scoop on these and more in this chapter excerpt from JavaScript: The Complete Reference, second edition, by Thomas Powell and Fritz Schneider McGraw-Hill/Osborne, ISBN 0072253576.

Author Info:
By: McGraw-Hill/Osborne
Rating: 4 stars4 stars4 stars4 stars4 stars / 92
October 26, 2004
TABLE OF CONTENTS:
  1. · JavaScript and Embedded Objects
  2. · Java
  3. · Including Applets
  4. · Accessing Applets in JavaScript
  5. · Issues with JavaScript-Driven Applets
  6. · Plug-ins
  7. · MIME Types
  8. · Detecting Specific Plug-Ins
  9. · Interacting with Plug-Ins
  10. · Refreshing the Plug-Ins Array
  11. · Interacting with a Specific Plug-In
  12. · ActiveX
  13. · Cross-Browser Inclusion of Embedded Objects
  14. · Interacting with ActiveX Controls
  15. · Summary

print this article
SEARCH DEVARTICLES

JavaScript and Embedded Objects - Plug-ins
(Page 6 of 15 )

Browser plug-ins are executable components that extend the browser’s capabilities in a particular way. When the browser encounters an embedded object of a type that it is not prepared to handle (e.g., something that isn’t HTML or other Web file type), the browser might hand the content off to an appropriate plug-in. If no appropriate plug-in is installed, the user is given the option to install one (assuming the page is properly written). Plug-ins consist of executable code for displaying or otherwise processing a particular type of data. In this way, the browser is able to hand special types of data, for example multimedia files, to plug-ins for processing.

Plug-ins are persistent in the browser in the sense that once installed, they remain there unless manually removed by the user. Most browsers come with many plug-ins already installed, so you may have used them without even knowing. Plug-ins were introduced in Netscape 2 but are supported, at least HTML–syntax-wise, by most major browsers, including Opera and Internet Explorer 3 and later. However, the actual component in the case of Internet Explorer is not a plug-in but instead an ActiveX control discussed later in the chapter. Plug-ins are a Netscape-introduced technology supported by many other browsers.

Embedding Content for Plug-Ins

Although never officially a part of any HTML specification, the <embed> tag is most often used to include embedded objects for Netscape and Internet Explorer. A Macromedia Flash file might be embedded as follows:

<embed id="demo" name="demo"
 src="http://www.javascriptref.com/examples/ch18/flash.swf"
 width="318" height="252" play="true" loop="false"
 pluginspage="http://www.macromedia.com/go/getflashplayer"
 swliveconnect="true"></embed>

The result of loading a page with this file is shown in Figure 18-3.

The most important attributes of the <embed> tag are src, which gives the URL of the embedded object, and pluginspage, which indicates to the browser where the required plug-in is to be found if it is not installed in the browser. Plug-in vendors typically make available the embedding syntax, so check their site for the value of pluginspage.

Recall that applets embedded with <object> tags are passed initial parameters in <param> tags. The syntax of <embed> is different in that initial parameters are passed using attributes of the element itself. For instance, in the preceding example the play attribute tells the plug-in to immediately begin playing the specified file.


FIGURE 18-3
An embedded Flash file

The <object> element is the newer, official way to include embedded objects of any kind in your pages. However, <object> is not supported in Netscape browsers prior to version 4, and <embed> continues to be supported by new browsers. So it is unlikely that <object> will completely supplant <embed> any time in the near future. However, <object> and <embed> are very often used together in order to maximize client compatibility. This technique is illustrated in the later ActiveX section of this chapter.

McGraw-Hill-OsborneThis chapter is from JavaScript: The Complete Reference, second edition, by Thomas Powell and Fritz Schneider, McGraw-Hill/Osborne, ISBN: 0072253576). Check it out at your favorite bookstore today.

Buy this book now.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials