在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
from: http://social.msdn.microsoft.com/Forums/zh-TW/236/thread/78f5f655-f378-4662-b73d-b6371d03f20c 1.在网站內新增一个项目叫做 浏览器文件", 它自动会产生一个App_Browsers的目录, 包含一个叫BrowserFile.browser的文件.
代码
1 <!--
2 You can find existing browser definitions at 3 <windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers 4 --> 5 <browsers> 6 <browser id="NewBrowser" parentID="Mozilla"> 7 <identification> 8 <userAgent match="Unique User Agent Regular Expression" /> 9 </identification> 10 11 <capture> 12 <userAgent match="NewBrowser (?'version'\d+\.\d+)" /> 13 </capture> 14 15 <capabilities> 16 <capability name="browser" value="My New Browser" /> 17 <capability name="version" value="${version}" /> 18 </capabilities> 19 </browser> 20 21 <browser refID="Mozilla"> 22 <capabilities> 23 <capability name="xml" value="true" /> 24 </capabilities> 25 </browser> 26 27 <browser id ="Safari3" parentID ="Safari1Plus"> 28 <identification > 29 <userAgent match ="Safari/\d+\.\d+"/> 30 </identification> 31 <capture> 32 <userAgent match ="Version/(?'version'\d+\.\d+)"/> 33 </capture> 34 <capabilities> 35 <capability name ="browser" value ="Safari3"/> 36 <capability name ="version" value ="${version}"/> 37 </capabilities> 38 <controlAdapters> 39 <adapter controlType ="System.Web.UI.WebControls.Menu" 40 adapterType =""/> 41 </controlAdapters> 42 </browser> 43 <browser id ="GoogleChrome" parentID ="Safari3"> 44 <identification> 45 <userAgent match ="Chrome/(?'version'\d+\.\d+)"/> 46 </identification > 47 <capabilities > 48 <capability name ="browser" value ="Googlebot"/> 49 </capabilities> 50 </browser> 51 </browsers>
p.s. 如果上述方法搞不定的話, 可以在Page_Load的地方加一代码: c#:
1 if(Request.UserAgent.IndexOf("AppleWebKit") > 0)
2 { 3 Request.Browser.Adapters.Clear(); 4 }
在 Page_PreInit加上代码
1 if (Request.UserAgent.IndexOf("AppleWebKit") > 0)
2 { 3 this.ClientTarget = "uplevel"; 4 }
VB:
1 If Request.UserAgent.IndexOf("AppleWebKit") > 0 Then Request.Browser.Adapters.Clear()
|
请发表评论