码迷,mamicode.com
首页 > Web开发 > 详细

html拨打电话

时间:2016-05-16 09:21:07      阅读:385      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
<%@ Page Language="C#" AutoEventWireup="true" Inherits="Jiubang.Wap.Page" Debug="true" ContentType="text/html; charset=UTF-8" %>
<%@ Import Namespace="Jiubang.Wap"%>
<%@ Import Namespace="Jiubang.Sql"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="CustomerAD.CommonLibrary" %>
<% Response.ContentType = "text/html; charset=UTF-8"; %>

<script runat="server">
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        this.TelNum = "400-8877766";
        
        int mobs=0;
        bool isuc=false;
        string http_ua=string.Empty;
        string http_pro=string.Empty;        
        Common.GetUAInfo(ref mobs, ref isuc, ref http_ua, ref http_pro);
        if (mobs == 3)
        {
            //iphone系列
            this.RefleshContent = "<meta http-equiv=\"refresh\" content=\"1;url=tel:" + this.TelNum + "\">";
            this.htmlContent = "<a href=\"tel:" + this.TelNum + "\">" + this.TelNum + "</a>";
        }
        else 
        {
            //安卓
            this.RefleshContent = "<meta http-equiv=\"refresh\" content=\"1;url=wtai://wp/mc;" + this.TelNum + "\">";
            this.htmlContent = "<a href=\"wtai://wp/mc;" + this.TelNum + "\">" + this.TelNum + "</a>";
        }
    }

    private string TelNum = string.Empty;
    private string RefleshContent = string.Empty;
    private string htmlContent = string.Empty;
    
</script>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width; initial-scale=1.0; minimum-scale=1.0; maximum-scale=1.0"/>
    <%=this.RefleshContent %>
    <title>拨打电话</title>
</head>

<body>
如果您的浏览器不支持自动拨打,请点击下面的连接拨打:<%=this.htmlContent %>
<br />
<div style="line-height:180%;text-align:center;">
    <%=LinkHelper.GetATag("index.aspx","返回首页") %>
</div>
</body>
</html>
View Code

 附上其中Common.GetUAInfo的方法

技术分享
        /// <summary>
        /// 获取用户UA信息
        /// </summary>
        /// <param name="MobSystem">操作系统,2为安卓,3为iphone,ipod等苹果系列</param>
        /// <param name="IsUC">是否UC</param>
        /// <param name="http_UA">UA参数</param>
        /// <param name="http_WapPro">用户配置信息</param>
        public static void GetUAInfo(ref int MobSystem, ref bool IsUC,ref string http_UA,ref string http_WapPro) 
        {
            int mobos = 0;            //操作系统版本
            int isuc = 0;                //是否UC
            string ALLUSERUA = "";    //用户UA
            string ALLWAPPRO = "";    //用户配置信息

            //获取UA
            if (HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"] != null)
            {
                ALLUSERUA = HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"].ToString().Trim();
            }
            //获取配置信息
            if (HttpContext.Current.Request.ServerVariables["HTTP_X_WAP_PROFILE"] != null)
            {
                ALLWAPPRO = "3G" + HttpContext.Current.Request.ServerVariables["HTTP_X_WAP_PROFILE"].ToString().Trim();
            }
            if (ALLUSERUA.IndexOf("UCWEB") > 0 || ALLWAPPRO.IndexOf("UCWEB") > 0 || ALLUSERUA.IndexOf("UCWEB") > 0 || ALLUSERUA.IndexOf(" UC ") > 0)
            {
                isuc = 1;
            }
            if (ALLUSERUA.IndexOf("QQBrowser") > 0 || ALLWAPPRO.IndexOf("QQBrowser") > 0 || ALLUSERUA.IndexOf("QQBrowser") > 0)
            {
                isuc = 1;
            }
            if (ALLUSERUA.IndexOf("Android") > 0 || ALLWAPPRO.IndexOf("Android") > 0 || ALLUSERUA.IndexOf("Ophone") > 0)
            {
                mobos = 2;
            }
            if (ALLUSERUA.IndexOf("UC") > 0 && ALLUSERUA.IndexOf("Linux") > 0)
            {
                mobos = 2;
            }
            if (ALLUSERUA.IndexOf("QQBrowser") > 0 && ALLUSERUA.IndexOf("Linux") > 0)
            {
                mobos = 2;
            }
            if (ALLUSERUA.IndexOf("iPhone") > 0 || ALLUSERUA.IndexOf("iPad") > 0 || ALLUSERUA.IndexOf("GT-I9000") > 0 || ALLUSERUA.IndexOf("IOS") > 0)
            {
                mobos = 3;
            }
            if (ALLUSERUA.IndexOf("UC") > 0 && ALLUSERUA.IndexOf("iOS") > 0)
            {
                mobos = 3;
            }
            if (ALLUSERUA.IndexOf("QQBrowser") > 0 && ALLUSERUA.IndexOf("iOS") > 0)
            {
                mobos = 3;
            }
            MobSystem = mobos;
            IsUC = (isuc == 1);
            http_UA = ALLUSERUA;
            http_WapPro = ALLWAPPRO;
        }
View Code

 

html拨打电话

标签:

原文地址:http://www.cnblogs.com/shouce/p/5496869.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!