Using a mobile browser to access JD.com’s domain name is http://m.jd.com
Using a computer to access JD.com is http://www.jd.com. Of course, the two pages are different. What’s wrong with this? Realized?
Write an example code if it is convenient, thank you!
After entering www.jd.com, if the code determines that it is a mobile phone, it will jump to m.jd.com
JD source code:
Just judge
UA
request.getHeader("user-agent")
userAgent
window.navigator.userAgent