Click to return to the Windows Media Technologies home page    
Web Workshop  |  Streaming & Interactive Media  |  Windows Media Technologies

Changing Properties of the Windows Media Player


September 21, 1998

If you want to change the properties of the Windows Media Player, you will need to detect which browser is being used, and provide different code for Internet Explorer and Netscape Navigator.

For example, let's look at the JavaScript version of the Buttons demo in the MSDN Online Web Workshop Downloads area. When the user presses the No Controls button, an OnClick event executes the ShowControls function and sets the setting parameter of that function to "true" (which would add controls under the embedded player).

<input TYPE="button" VALUE="Full Controls" NAME="Minimal"
   OnClick="ShowControls(true)" style="font-family:courier">
The ShowControls function is defined as follows:

function ShowControls (setting)
  {
      if (navigator.appName == "Netscape")
         {document.MediaPlayer.SetShowControls(setting)}
      else
         {document.MediaPlayer.ShowControls = setting}
  }   /* end ShowControls() */

The function first checks to see which browser is being used. If it is Netscape Navigator, it executes the following code:

document.MediaPlayer.SetShowControls(setting)

If the browser is not Netscape Navigator (meaning it is probably Internet Explorer), this code is executed:

document.MediaPlayer.ShowControls = setting

As you can see from these two statements, the Netscape Navigator and Internet Explorer code differ in two ways:

HomeBack to the Advanced Scripting for Cross-Browser Functionality page



Back to topBack to top

Did you find this material useful? Gripes? Compliments? Suggestions for other articles? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.