Discussion Forums  >  WebViews and HTML for Mobile

Replies: 2    Views: 107

Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
07/19/13 01:14 AM (10 years ago)

Mobile sites

Does anyone know how to prevent mobile websites from loading automatically? I'm specifically referring to Android. Many thanks.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
07/19/13 03:24 AM (10 years ago)
Interesting question. What I 'think' you mean is, if the server somewhere detects a mobile device, it displays a 'mobile' web page rather than the page you'd get from a desktop browser. If that's the case, then it's possible this might work: System.setProperty("http.agent", ""); Which I found in this post on SO... http://stackoverflow.com/questions/2529682/setting-user-agent-of-a-java-urlconnection What happens is, on the 'server' side, where there is nothing we can do about it (unless it's our server, I suppose) the webserver software 'detects' the kind of 'User-Agent' you're using, and places it in a session variable. If it or the PHP framework is prepared to handle those requests, then it obtains the user agent string from the session variable, and provides content according to how it thinks it should. So, if you want it to react like a desktop, you'll have to make it think it's talking to a desktop. Cheers! -- Smug
 
Alex@TM
Apple Fan
Profile
Posts: 956
Reg: Dec 20, 2011
London, UK
10,560
like
07/19/13 03:48 AM (10 years ago)
Cool, thanks Smug. Exactly what I was after!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.