How to check if the web page is visited by a phone browser or a PC browser?

Like Mikko wrote, no simple ways to detect mobile.

But you can try:

And something like previous answer:


There is not any simple 'mobile=true' flag. You simply have to check by yourself. From here you can find subset of of values to search (list is rather old, so newer mobile browsers should be added).


this is a good link I just found:

var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    BlackBerry: function() {
       return navigator.userAgent.match(/BlackBerry/i);
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() ||      isMobile.Opera() || isMobile.Windows());

Here's some context: I'm working on an assignment to collapse an edge in a mesh that is stored half-edge data structure. This is the immediately relevant code. System.out.println("Initial Size: " ...

I'm trying to write custom JFrame and JPanel for my Java application. Currently, I just want to have a JPanel with a start button in the very middle of the screen. So, here's the code I have: package ...

We're thinking of using Protocol Buffers for binary logging because: It's how we're encoding our objects anyway It is relatively compact, fast to read / write etc. That said, it isn't obvious how we ...

I am running Gnome on OpenSuse. As a result, my system look and feel is GTK+, which has numerous ugly problems (see some of them here). During development of my swing app, I can run the client from ...