處理 xhtml 時,要獲得最大的兼容性,就需要向 Firefox、safari、Opera 和其他符合標準的瀏覽器發送 application/xhtml+xml,而向 IE 發送 text/html:
程序代碼
<%dim xm
if instr(request.servervariables("http_accept"), "application/xhtml+xml") > 0 or instr(request.servervariables("http_user_agent"), "w3c_validator") > 0 then
response.contenttype="application/xhtml+xml"
xm="<!doctype html public ""-//w3c//dtd xhtml 1.1//en"" ""QQface.VeVb.com/
response.contenttype="text/html"
xm="<!doctype html public ""-//w3c//dtd xhtml 1.0 strict//en"" ""end if
%>
測試:用ie訪問查看源代碼可以看見輸出的是xhtml 1.0 strict。ff或opera下是xhtml1.1,不改也可以通過驗證,只不過會有一段警告信息。
新聞熱點
疑難解答