Partager via


Detecting the Player

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

When creating a webpage for your online store, you may decide that you want users to be able to view the page in a Web browser or in Windows Media Player. You can use an ASP script to determine whether your webpage is hosted in the Player.

The following example code retrieves the version parameter from the URL query string to determine whether the page is hosted in Windows Media Player:

<%
    Dim sVersion

    sVersion = Trim(Request.QueryString("version")) 
 
    If sVersion = "" Then   
        Response.Write "Not hosted in Windows Media Player"
    Else 
        Response.Write "Hosted in Windows Media Player<BR>"
        Response.Write "Version is " & sVersion
    End If
%>

Note that the preceding code assumes that the version parameter exists in the query string when hosted in Windows Media Player. This is true for pages opened by the user, but may not be true for pages opened by using External.NavigateTaskPaneURL. For the version query string to exist when navigating programmatically, you must add the version parameter to the method call or dynamically append the version to the base URL of the Navigate element of your ServiceInfo document.

Creating the ServiceInfo Document Dynamically

External.NavigateTaskPaneURL

Information Common to Type 1 and Type 2 Online Stores