บทช่วยสอน ASP

ASP HOME

กวดวิชา WP

แนะนำหน้าเว็บ มีดโกนหน้าเว็บ เค้าโครงหน้าเว็บ โฟลเดอร์หน้าเว็บ หน้าเว็บทั่วโลก แบบฟอร์มหน้าเว็บ วัตถุหน้าเว็บ ไฟล์หน้าเว็บ ฐานข้อมูลหน้าเว็บ ผู้ช่วยหน้าเว็บ หน้าเว็บ WebGrid แผนภูมิหน้าเว็บ อีเมลหน้าเว็บ ความปลอดภัยของหน้าเว็บ เผยแพร่หน้าเว็บ ตัวอย่างหน้าเว็บ ชั้นเรียนของหน้าเว็บ

มีดโกน ASP.NET

แนะนำมีดโกน มีดโกนไวยากรณ์ มีดโกน C# ตัวแปร มีดโกน C# ลูป มีดโกน C# Logic ตัวแปรมีดโกน VB มีดโกน VB Loops มีดโกน VB Logic

ASP Classic

แนะนำ ASP ไวยากรณ์ ASP ตัวแปร ASP ขั้นตอน ASP เงื่อนไข ASP ASP วนรอบ แบบฟอร์ม ASP คุกกี้ ASP เซสชัน ASP แอปพลิเคชัน ASP ASP #รวม ASP Global.asa ASP AJAX อีเมล ASP ตัวอย่าง ASP

การอ้างอิง ASP

ฟังก์ชัน ASP VB คีย์เวิร์ด ASP VB การตอบสนอง ASP คำขอ ASP แอปพลิเคชัน ASP เซสชัน ASP เซิร์ฟเวอร์ ASP ข้อผิดพลาด ASP ASP FileSystem ASP TextStream ไดรฟ์ ASP ไฟล์ ASP โฟลเดอร์ ASP พจนานุกรม ASP ASP AdRotator ASP BrowserCap การเชื่อมโยงเนื้อหา ASP ตัวหมุนเนื้อหา ASP ASP Quick Ref

กวดวิชา ADO

แนะนำ ADO ADO Connect ชุดระเบียน ADO จอแสดงผล ADO แบบสอบถาม ADO ADO Sort เพิ่ม ADO ADO Update ADO ลบ สาธิต ADO ADO เร่งความเร็ว

วัตถุ ADO

คำสั่ง ADO การเชื่อมต่อ ADO ข้อผิดพลาด ADO ADO Field พารามิเตอร์ ADO ADO พร็อพเพอร์ตี้ บันทึก ADO ชุดระเบียน ADO ADO สตรีม ประเภทข้อมูล ADO

ส่วนประกอบความสามารถของเบราว์เซอร์ ASP


ส่วนประกอบความสามารถของเบราว์เซอร์ ASP

คอมโพเนนต์ ASP Browser Capabilities สร้างอ็อบเจ็กต์ BrowserType ที่กำหนดประเภท ความสามารถ และหมายเลขเวอร์ชันของเบราว์เซอร์ของผู้เยี่ยมชม

เมื่อเบราว์เซอร์เชื่อมต่อกับเซิร์ฟเวอร์ ส่วนหัว User Agent จะถูกส่งไปยังเซิร์ฟเวอร์ด้วย ส่วนหัวนี้มีข้อมูลเกี่ยวกับเบราว์เซอร์

ออบเจ็กต์ BrowserType เปรียบเทียบข้อมูลในส่วนหัวกับข้อมูลในไฟล์บนเซิร์ฟเวอร์ชื่อ "Browscap.ini"

หากมีการจับคู่ระหว่างประเภทเบราว์เซอร์และหมายเลขเวอร์ชันในส่วนหัวและข้อมูลในไฟล์ "Browscap.ini" คุณสามารถใช้วัตถุ BrowserType เพื่อแสดงรายการคุณสมบัติของเบราว์เซอร์ที่ตรงกันได้ หากไม่มีประเภทและหมายเลขเวอร์ชันของเบราว์เซอร์ตรงกันในไฟล์ Browscap.ini จะตั้งค่าคุณสมบัติทั้งหมดเป็น "UNKNOWN"

ไวยากรณ์

<%
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%>

ตัวอย่างความสามารถของเบราว์เซอร์ ASP

ตัวอย่างด้านล่างสร้างอ็อบเจ็กต์ BrowserType ในไฟล์ ASP และแสดงความสามารถบางอย่างของเบราว์เซอร์ของคุณ:

ตัวอย่าง

<!DOCTYPE html>
<html>
<body>
<%
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
%>

<table border="0" width="100%">
<tr>
<th>Client OS</th><th><%=MyBrow.platform%></th>
</tr><tr>
<td >Web Browser</td><td ><%=MyBrow.browser%></td>
</tr><tr>
<td>Browser version</td><td><%=MyBrow.version%></td>
</tr><tr>
<td>Frame support?</td><td><%=MyBrow.frames%></td>
</tr><tr>
<td>Table support?</td><td><%=MyBrow.tables%></td>
</tr><tr>
<td>Sound support?</td><td><%=MyBrow.backgroundsounds%></td>
</tr><tr>
<td>Cookies support?</td><td><%=MyBrow.cookies%></td>
</tr><tr>
<td>VBScript support?</td><td><%=MyBrow.vbscript%></td>
</tr><tr>
<td>JavaScript support?</td><td><%=MyBrow.javascript%></td>
</tr>
</table>

</body>
</html>

เอาท์พุท:

Client OS WinNT
Web Browser IE
Browser version 5.0
Frame support? True
Table support? True
Sound support? True
Cookies support? True
VBScript support? True
JavaScript support? True



ไฟล์ Browscap.ini

ไฟล์ "Browscap.ini" ใช้เพื่อประกาศคุณสมบัติและตั้งค่าเริ่มต้นสำหรับเบราว์เซอร์

ส่วนนี้ไม่ใช่บทช่วยสอนเกี่ยวกับวิธีดูแลไฟล์ "Browscap.ini" แต่จะแสดงเฉพาะข้อมูลพื้นฐานเท่านั้น คุณจึงเข้าใจว่าไฟล์นี้เกี่ยวกับอะไร

ไฟล์ "Browscap.ini" สามารถมีดังต่อไปนี้:

[;comments]
[HTTPUserAgentHeader]
[parent=browserDefinition]
[property1=value1]
[propertyN=valueN]
[Default Browser Capability Settings]
[defaultProperty1=defaultValue1]
[defaultPropertyN=defaultValueN]

Parameter Description
comments Optional. Any line that starts with a semicolon are ignored by the BrowserType object
HTTPUserAgentHeader Optional. Specifies the HTTP User Agent header to associate with the browser-property value statements specified in propertyN. Wildcard characters are allowed
browserDefinition Optional. Specifies the HTTP User Agent header-string of a browser to use as the parent browser. The current browser's definition will inherit all of the property values declared in the parent browser's definition
propertyN Optional. Specifies the browser properties. The following table lists some possible properties:
  • ActiveXControls - Support ActiveX controls?
  • Backgroundsounds - Support background sounds?
  • Cdf - Support Channel Definition Format for Webcasting?
  • Tables - Support tables?
  • Cookies - Support cookies?
  • Frames - Support frames?
  • Javaapplets - Support Java applets?
  • Javascript - Supports JScript?
  • Vbscript - Supports VBScript?
  • Browser - Specifies the name of the browser
  • Beta - Is the browser beta software?
  • Platform - Specifies the platform that the browser runs on
  • Version - Specifies the version number of the browser
valueN Optional. Specifies the value of propertyN. Can be a string, an integer (prefix with #), or a Boolean value
defaultPropertyN Optional. Specifies the name of the browser property to which to assign a default value if none of the defined HTTPUserAgentHeader values match the HTTP User Agent header sent by the browser
defaultValueN Optional. Specifies the value of defaultPropertyN. Can be a string, an integer (prefix with #), or a Boolean value

ไฟล์ "Browscap.ini" อาจมีลักษณะดังนี้:

;IE 5.0
[IE 5.0]
browser=IE
Version=5.0
majorver=#5
minorver=#0
frames=TRUE
tables=TRUE
cookies=TRUE
backgroundsounds=TRUE
vbscript=TRUE
javascript=TRUE
javaapplets=TRUE
ActiveXControls=TRUE
beta=False

;DEFAULT BROWSER
[*]
browser=Default
frames=FALSE
tables=TRUE
cookies=FALSE
backgroundsounds=FALSE
vbscript=FALSE
javascript=FALSE