首页 > 其他 > 详细

request浏览器判断

时间:2015-06-11 06:53:45      阅读:124      评论:0      收藏:0      [点我收藏+]
public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        String agent = request.getHeader("User-Agent");
        if (agent.contains("Trident")) {
            response.getWriter().print("不准使用这么垃圾的浏览器");
        } else if (agent.contains("Chrome")) {
            response.getWriter().print("您当前使用的浏览器是谷歌");
        } else if (agent.contains("Firefox")) {
            response.getWriter().print("您当前使用的浏览器是火狐");
        } else {
            response.getWriter().print("其他浏览器");
        }
    }

 

request浏览器判断

原文:http://www.cnblogs.com/sflik/p/4567884.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!