SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: The client is using Android....
-
Nov 4, 2012, 23:35 #1
- Join Date
- Jan 2012
- Location
- Philippines
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The client is using Android....
From time to time I have been encoding classic ASP pages for my use.
Using the MobileESP Classic ASP source code;
https://bitbucket.org/mbarrero/mobil....asp?at=master
How can I check whether the client is using the usual desktop PC... or an android tablet on my ASP page?? The link only includes the source code on how to detect the clients browser if it is regular desktop or android tablet, but it does not elaborate how to use it.
-
Feb 17, 2013, 04:45 #2
You can use javascript, such as...
<script type="text/javascript">
if (screen.width<600)
window.location = "./mobile/";
</script>Buy visitors as low as 0.01 cent per unique visitor.
The easiest way to improve alexa ranking effectively, full refund guaranteed!
-
Feb 19, 2013, 00:33 #3
- Join Date
- Jan 2012
- Location
- Philippines
- Posts
- 19
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Detecting Mobile Devices in Classic ASP
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <% Dim user_agent, mobile_browser, Regex, match, mobile_agents, mobile_ua, i, size user_agent = Request.ServerVariables("HTTP_USER_AGENT") mobile_browser = 0 Set Regex = New RegExp With Regex .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm)" .IgnoreCase = True .Global = True End With match = Regex.Test(user_agent) If match Then mobile_browser = mobile_browser+1 If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/vnd.wap.xhtml+xml") Or Not IsEmpty(Request.ServerVariables("HTTP_X_PROFILE")) Or Not IsEmpty(Request.ServerVariables("HTTP_PROFILE")) Then mobile_browser = mobile_browser+1 End If 'list of devices, this is an array so just add more that come to the marketplace into here mobile_agents = Array("alcatel", "amoi", "android", "avantgo", "blackberry", "benq", "cell", "cricket", "docomo", "elaine", "htc", "iemobile", "iphone", "ipad", "ipaq", "ipod", "j2me", "java", "midp", "mini", "mmp", "mobi", "motorola", "nec-", "nokia", "palm", "panasonic", "philips", "phone", "sagem", "sharp", "sie-", "smartphone", "sony", "symbian", "t-mobile", "telus", "up\.browser", "up\.link", "vodafone", "wap", "webos", "wireless", "xda", "xoom", "zte") size = Ubound(mobile_agents) mobile_ua = LCase(Left(user_agent, 4)) For i = 0 To size If mobile_agents(i) = mobile_ua Then mobile_browser = mobile_browser+1 Exit For End If Next 'check that full website has not been requested (you can have a link in the page for this like: view Full Site If request.querystring("v")="full" then session("fullsite")=true If mobile_browser>0 and session("fullsite")=false then response.redirect("tablet.asp") End If %> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
It works for me.
-
Feb 25, 2013, 01:34 #4
- Join Date
- Jun 2010
- Location
- San Jose California
- Posts
- 21
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try to use this code:
Code ASP:public void recieveMessage() { Log.e("xmppclient","will receive messages"); PacketFilter filter = new MessageTypeFilter(Message.Type.chat); connection.addPacketListener(new PacketListener() { public void processPacket(Packet packet) { if(connection != null && connection.isConnected()) { Message message = (Message) packet; if (message.getBody() != null) { fromName = StringUtils.parseBareAddress(message.getFrom()); String messageBody=message.getBody(); Log.e("Message", messageBody ); Intent i = new Intent(NEW_MESSAGE); i.putExtra("username", StringUtils.parseBareAddress(message.getFrom())); i.putExtra("message", message.getBody()); sendBroadcast(i); } else { connectToXmpp(); } } } } ,filter); }
Last edited by Mittineague; Feb 26, 2013 at 14:00.
-
Feb 25, 2013, 14:26 #5
- Join Date
- Oct 2002
- Location
- Scotland
- Posts
- 3,631
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
How will that help? That's ASP .NET
Bookmarks