I try to get webpage using HttpURLConnection, and get a result of mobile version page.
Now I want to get a desktop version page, and try to use: System.setProperty("http.agent", "Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0"); or setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; rv:7.0.1) Gecko/20100101 Firefox/7.0"); But I still get a result of mobile version page.
Does anyone know how to get a desktop version source code of webpage instead the mobile version?
PS: My Android is 2.3.7
You have to set the User-Agent of your connection to pretend that it’s a desktop client.
As you are using the HttpUrlConnection, you can do something like: