Tip

How to support Flash objects in any Web browser for a Lotus Notes Domino application

When building applications for Lotus Notes and Domino Server, developers often need to support several different Web browser versions and types. The JavaScript code in this tip shows how to support Flash objects on any Web browser that understands JavaScript or ActiveX.
More JavaScript resources:
JavaScript FAQs

JavaScript Learning Guide

JavaScript Reference Center

If the Web browser supports MIME-type applications, the JavaScript writes out an EMBED tag to display the Flash animation. Otherwise, it will write an IMG tag to display only a graphic.

The OBJECT tag is invoked on any browser that supports ActiveX, regardless of which tag JavaScript writes.

Make sure that there are no line breaks in your EMBED or IMG tags, or the JavaScript will fail. If you'd like to use line breaks, you can put each line in a separate document.write() command.

Notice that the entire EMBED and IMG strings are enclosed in single quotes; this allows for double quotes to be inside of the strings, without breaking them or having to use a slash to declare each quotation mark (").

 <object classid=
"clsid:D27CDB6E-AE6D-11
cf-96B8-444553540000" codebase=
"http://download.macromedia.com/pub/shockwave/
cabs/flash/ swflash.cab#version=5,0,0,0" 
width="466" height="233">
          <param name=movie value=
"/<Computed Value>
/Movement-joystick.swf">
          <param name=quality 
value=high>

<!-- begin the JavaScript -->
<SCRIPT LANGUAGE="JavaScript">
//Determine if  the browser understands 
the mimeTypes property and recognizes 
//"application/x-shockwave-flash"...

if (navigator.mimeTypes && 
navigator.mimeTypes["application/ 
x-shockwave-flash"]){

   //The browser can interpret mimeTypes 
so write out the <embed> 
</embed> tags to the document.

   document.write('<embed src=
"/<Computed Value>/Movement-joystick.swf" 
quality=high luginspage=
"http://www.macromedia.com/shockwave/
download/index.cgi?P1_Prod_ 
Version=ShockwaveFlash" type="application/
x-shockwave-flash" width="466" height="233">
</embed>');

} else {
   //...browser doesn't recognize mimeTypes 
so substitute the movie with a graphic 
using the <IMG> tag

   document.write('<IMG SRC="noflashpic.gif" 
WIDTH="220" HEIGHT="110" ALT=
"Non-Flash User Picture">'); } </SCRIPT>
<!-- Close the OBJECT tag. -->
</object>

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Steve Camps. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was first published in June 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.