<?php function isMobile(){ $useragent=isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $useragent_commentsblock=preg_match('|\(.*?\)|',$useragent,$matches)>0?$matches[0]:''; function CheckSubstrs($substrs,$text){ foreach($subst…
function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i…
判断页面浏览设备是手机还是电脑,代码如下: function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sU…
var system ={}; var p = navigator.platform; system.win = p.indexOf("Win") == 0; system.mac = p.indexOf("Mac") == 0; system.x11 = (p == "X11") || (p.indexOf("Linux") == 0); if(system.win||system.mac||system.xll){//如果…
var browser = { os : function() { var u = navigator.userAgent; return {// 操作系统 linux: !!u.match(/\(X11;( U;)? Linux/i), // Linux windows: !!u.match(/Windows/i), // Windows android: !!u.match(/Android/i), // Android iOS: !!u.match(/\(i[^;]+;( U;)? CPU…
<script type="text/javascript"> var commonURL = 'http://xxxx.com/'; function mobile_device_detect(url){ var thisOS=navigator.platform; var os=new Array("iPhone","iPod","iPad","android","Nokia&qu…
package com.lwj.util; import javax.servlet.http.HttpServletRequest; /** * 判断访问设备为PC或者手机--工具类 * * @description: * @fileName:HttpRequestDeviceUtils.java * @createTime:2015年12月15日 下午3:26:19 * @author:liwenjian * @version 1.0.0 * */ public class DeviceUt…
js判断是手机还是电脑访问网站                               <script type="text/javascript"> <!-- //平台.设备和操作系统 var system ={ win : false, mac : false, xll : false }; //检测平台 var p = navigator.platform; system.win = p.indexOf("Win") == 0; syst…
/** * 判断当前设备是手机还是平板,代码来自 Google I/O App for Android * @param context * @return 平板返回 True,手机返回 False */ public static boolean isTablet(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_…
转自:http://blog.csdn.net/zuolongsnail/article/details/8682950 Android开发需要适配手机和平板,有些需求在实现中就要判断设备是手机还是平板. 网上有的说直接判断是否有电话功能,不过现在的平板有的也支持电话功能了. 所以只能通过计算设备尺寸大小的方法来判断是手机还是平板了. 源码如下: /** * 判断是否为平板 * * @return */ private boolean isPad() { WindowManager wm = (…