Microsoft KB Archive/279022

= Auto embedding Windows Media Player 7 in Web page if it is installed on the client =

Article ID: 279022

Article Last Modified on 11/19/2007

-

APPLIES TO


 * Microsoft Windows Media Player 6.0
 * Microsoft Windows Media Player 6.1
 * Microsoft Windows Media Player 6.2
 * Microsoft Windows Media Player 6.4
 * Microsoft Windows Media Player 7.0
 * Microsoft Windows Media Player 7.1

-



This article was previously published under Q279022



SUMMARY
When you embed a Windows Media Player client into a Web page, you can use client-side code to detect whether version 7 or later is installed. In doing so, you can take advantage of version 7 or later features if that version is installed.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

The following code enables your Web page to embed Windows Media Player 7 if the client has it installed. If the client does not have version 7 installed, but it does have an earlier version, that version will be displayed instead. Embedding Windows Media Player





Here is the same code, but in JavaScript form: Embedding Windows Media Player



var WMP7;

if(window.ActiveXObject) {   WMP7 = new ActiveXObject(&quot;WMPlayer.OCX.7&quot;); } else if (window.GeckoActiveXObject) {    WMP7 = new GeckoActiveXObject(&quot;WMPlayer.OCX.7&quot;); }

// Windows Media Player 7 Code if ( WMP7 ) {    document.write (''); document.write (''); document.write (''); document.write (''); document.write (''); document.write (''); }

// Windows Media Player 6.4 Code else {    //IE Code document.write (''); document.write (''); document.write (''); document.write ('');

//Netscape code document.write ('   <Embed type=&quot;application/x-mplayer2&quot;'); document.write ('       pluginspage=&quot;http://www.microsoft.com/windows/windowsmedia/&quot;'); document.write ('       filename=&quot;http://ncnetshow/station1.asx&quot;'); document.write ('       src=&quot;http://ncnetshow/station1.asx&quot;'); document.write ('       Name=MediaPlayer'); document.write ('       ShowControls=1'); document.write ('       ShowDisplay=1'); document.write ('       ShowStatusBar=1'); document.write ('       width=290'); document.write ('       height=320>'); document.write ('   ');

document.write ('</OBJECT>'); }

</SCRIPT>

Additional query words: netshow wmplayer

Keywords: kbproductlink kbcode kbinfo KB279022

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.