How to detect if user visit our site via mobile browser or PC browser?
In some cases, we want to know if user visit our site via mobile browser or via PC. Maybe for purpose of give different presentation to user because we prepared two different site for them. Below is script to inject in your site in case you want to give user different view of your site. <!DOCTYPE html> < html > < head > < title > Detect Mobile Browser </ title > < script type = "text/javascript" > ( function (a,b) { if ( /(android | bb \d +| meego) . + mobile | avantgo | bada \/ | blackberry | blazer | compal | elaine | fennec | hiptop | iemobile | ip(hone | od) | iris | kindle | lge | maemo | midp | mmp | mobile . + firefox | netfront | opera m(ob | in)i | palm( os) ?| phone | p(ixi | re) \/ | plucker | pocket | psp | series(4 | 6)0 | symbian | treo | up \. (browser | link) | vodafone | wap | windows ce | xda | xiino/ i . test ( a ) || /1207 | 6310 | 6590 | 3gso | 4thp