Browser file definition for mobile Web Development

Source: Internet
Author: User

Today, I added a web operation interface to my account system to help my lover add operation records on her mobile phone. This system uses nbear for data access.

The development is normal and the query records are displayed. I hope to display a table on my wife's mobile phone. The operating system of her mobile phone is ie4.01, which is supported. however, it won't work in any case. it seems to be.. Net cannot be identified.

There are many ways to solve this problem, including property rewriting and template output, but they are not very convenient. It's really hateful to think about it. Obviously the system supports it, but it doesn't work. The reason for subsequent tracking is that. Net does not correctly identify the browser of the client, so it began to study browser definition files.

Finally, it was found that the useragent of the client has a Windows CE, so it was rejected by. NET and processed as the most common Mozilla Browser. There is no way, so I had to define a browser definition file and finally solve it. The browser definition file is as follows for your reference.

 

<Browser id = "dopod900" parentid = "Mozilla">
<Identification>
<Useragent match = "^ dopod900 Mozilla [^ (] * \ ([c | C] ompatible; \ s * MSIE (? 'Version '(? 'Major' \ D + )(? 'Minor' \. \ D + )(? 'Letters '\ W *))(? 'Extra '[^)] *) "/>
</Identification>

<Capture>
<Useragent match = "dopod900"/>
</Capture>

<Capabilities>
<Capability name = "Browser" value = "ie"/>
<Capability name = "extra" value = "$ {Extra}"/>
<Capability name = "iscolor" value = "true"/>
<Capability name = "letters" value = "$ {letters}"/>
<Capability name = "majorversion" value = "$ {major}"/>
<Capability name = "minorversion" value = "$ {minor}"/>
<Capability name = "screenbitdepth" value = "8"/>
<Capability name = "type" value = "ie $ {major}"/>
<Capability name = "version" value = "$ {version}"/>
<Capability name = "activexcontrols" value = "true"/>
<Capability name = "backgroundsounds" value = "true"/>
<Capability name = "CDF" value = "true"/>
<Capability name = "cookies" value = "true"/>
<Capability name = "css1" value = "true"/>
<Capability name = "ecmascriptversion" value = "1.2" type = "apiname" text = "apiname"/>
<Capability name = "frames" value = "true"/>
<Capability name = "javaapplets" value = "true"/>
<Capability name = "JavaScript" value = "true"/>
<Capability name = "jscriptversion" value = "3.0"/>
<Capability name = "msdomversion" value = "4.0" type = "regxph" text = "yourobjectname"/>
<Capability name = "supportsfileupload" value = "true"/>
<Capability name = "supportsmultilinetextboxdisplay" value = "false"/>
<Capability name = "supportsmaintainscrollpositiononpostback" value = "true"/>
<Capability name = "tables" value = "true"/>
<Capability name = "tagwriter" value = "system. Web. UI. htmltextwriter"/>
<Capability name = "VBScript" value = "true"/>
</Capabilities>
</Browser>

 

After the definition file is added,. Net can correctly identify the client's browser capabilities. Thus, the correct choice is adapted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.