Write in front
Using HTML5 in a project requires a different approach to the client browser, which requires that the useragent in the request be parsed and processed.
An example
<%@ Page Language="C #"AutoEventWireup="true"codebehind="Default.aspx.cs"Inherits="Wolfy.RedirectDemo.Default" %><!DOCTYPE HTML><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Headrunat= "Server"> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title></title></Head><Body> <formID= "Form1"runat= "Server"> <DivID= "MSG"> </Div> </form></Body></HTML><Script> functionCheckclinetmodel () {//gets the useragent in the request header varu=navigator.useragent; //whether it is an Android browser varisandroid=U.indexof ('Android') > -1; //whether it is an iOS browser varIsios= !!U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS X/); varmsg= "'; if(isandroid) {msg= "currently an Android client"; } Else if(Isios) {msg= 'currently an iOS client'; } Else{msg= 'is currently PC-side'; }; document.getElementById ("msg"). InnerHTML=msg; }; Checkclinetmodel ();</Script>
For the adaptive page, you can add this meta
<name= "Viewport" content= "Width=device-width, initial-scale=1 , maximum-scale=1, minimum-scale=1, user-scalable=no "/>
Test
Summarize
It is recorded here and will be used frequently in the future.
JS to determine whether the Pc,ios,android client