쿠키로 Browser Capabilities 검색

IIS 5.0에는 클라이언트 기능을 지정하는 새 방법이 추가되었습니다. 요청대로 클라이언트가 해당 기능을 설명하는 쿠키를 보내면, 이 쿠키에 의해 지정된 이름 값 쌍을 속성으로 추가하는 Browser Capabilities 구성 요소 인스턴스를 사용자 ASP 페이지에 만들 수 있습니다.

예를 들어 클라이언트에서 userLanguage=Spanish인 이름 값 쌍이 포함된 쿠키를 보내면, Browser Capabilities 구성 요소는 userLanguage 속성을 추가하고 이 속성 값을 Spanish로 설정합니다.

중요

Server.Transfer 또는 Server.Execute 메서드를 사용하여 리디렉션 결과로 클라이언트가 요청한 파일에 METADATA 메타 태그가 있으면 IIS는 메타 태그를 무시합니다. 그러나 실제로 리디렉션이 포함된 파일에 있는 METADATA 메타 태그는 정상적으로 처리됩니다.

다음은 쿠키를 사용하여 browser capabilites를 지정하는 것을 보여주는 예제입니다. (이 예제에는) 다음 두 파일이 필요합니다.

--- SendCook.htm ---

<HTML>
<HEAD>

<SCRIPT language="JavaScript">

function stopAllErrors() 
{
   // No errors should be presented to the user if they occur.   
  return true;
}
window.onerror = stopAllErrors; 

function window.onload ()
{
  oClientCaps.style.behavior = "url(#default#clientCaps)";
  bcString   =  "width= "          + oClientCaps.width;
  bcString  +=  "&height= "        + oClientCaps.height;
  bcString  +=  "&bufferDepth= "   + oClientCaps.bufferDepth;
  bcString  +=  "&colorDepth= "    + oClientCaps.colorDepth;
  bcString  +=  "&cookies= "       + oClientCaps.cookieEnabled;
  bcString  +=  "&platform= "      + oClientCaps.platform;
  document.cookie = "BrowsCap= "   + bcString;
}
</SCRIPT>

</HEAD>

<BODY ID="oClientCaps">
</BODY>

</HTML>

--- CheckCap.asp ---

<!--METADATA TYPE="Cookie" NAME="BrowsCap" SRC="sendcook.htm"-->
<HTML>

<BODY>
<% Set myBrowsCap = Server.CreateObject("MSWC.BrowserType") %>
<%
  Response.write("width= "        +myBrowsCap.width            + "<BR>")
  Response.write("height= "       +myBrowsCap.height           + "<BR>")
  Response.write("bufferDepth= "  +myBrowsCap.bufferDepth      + "<BR>")
  Response.write("colorDepth= "   +myBrowsCap.colorDepth       + "<BR>")
  Response.write("cookies= "      +CStr(myBrowsCap.cookies)    + "<BR>")
  Response.write("platform= "     +myBrowsCap.platform         + "<BR>")
%>
</BODY>

</HTML>

browser capabilities를 결정하는 데 필요한 디자인 함축 정보에 대한 자세한 내용은 클라이언트 기능을 참조하십시오.


© 1997-2001 Microsoft Corporation. All rights reserved.