Code snippets, code sharing, PHP code sharing, Java code sharing, Ruby code sharing, Python code sharing, HTML code sharing, CSS code sharing, SQL code sharing, to share JavaScript code, you must require the mobile web page to run in the browser. The first thought is to add JavaScript code on the page to verify whether the browser is used.
The code is as follows:
/* Determine whether the browser */function isweixin () {var ua = navigator. userAgent. toLowerCase (); if (ua. match (/MicroMessenger/I) = "micromessenger") {return true;} else {return false ;}} is unwilling to modify because there are many pages. So I plan to use the JAVA filter to find information .. getHeader ("user-agent") can obtain the String ua = (HttpServletRequest) request of the browser ). getHeader ("user-agent "). toLowerCase (); if (ua. indexOf ("micromessenger")> 0) {// browser validation = true ;}
The above is to teach you how to use JS and JAVA to determine whether it is the details of a browser. For more information, see other related articles on php Chinese network!