Forum/Help & Support

Works for one phone, not another?

support
posted this on February 09, 2010 08:04

Works for one phone, not another?
 

Comments

User photo
support
Handset Detection
Hi all. Two questions. Question 1: I converted the c# code example to vb.net, and put it on my index.aspx page (i\'ve taken the \'private\' details out). It looks like this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim hd As HDBase = New HDBase(myemail, mysecret) hd.setv2ApiKey(mytoken) hd.setURL(\"http://api-us1.handsetdetection.com\") hd.detectInit(Request) \'hd.setDetectVar(\"user-agent\", \"Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/12.0.013; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413\"); If (hd.detect(\"all\")) Then Response.Redirect(\"mobile.aspx\", True) End If End Sub Now, if i access my web page using my N95 8GB, it works fine. However, I\'ve asked a couple of friends to access my website, and they dont get redirected? One\'s using a Samsung Tocco, the other a Nokia E72. Am i missing something? Question 2: What\'s the bit that adds to my hit statistics? Because when i redirect to my mobile page, my code looks like this: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim hd As HDBase = New HDBase(myemail, mysecret) hd.setv2ApiKey(mytoken) hd.setURL(\"http://api-us1.handsetdetection.com\") hd.detectInit(Request) \'hd.setDetectVar(\"user-agent\", \"Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/12.0.013; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413\"); If (hd.detect(\"display, product_info, flash_lite\")) Then \'display flash lite version, screen width, device model etc etc etc End If End Sub But i\'m kinda thinking every time a mobile user hits my index.aspx, it\'s adding \'2\' to my hit stats? Thanks for any help!
February 09, 2010 08:04
User photo
support
Handset Detection
Could you tell me your web site URL please? I\'d like to do some tests. Thanks
February 11, 2010 09:25
User photo
support
Handset Detection
Hi, Bill. I\'ve just emailled you the details. Thanks.
February 12, 2010 04:34
User photo
support
Handset Detection
I have received it, thanks. And this morning I tested your homepage with different devices: Nokia E72,Samsung SGH-f480 and Nokia N95, they worked fine. When you put the code into your website, comment this line first. \\\'hd.setDetectVar(\\\"user-agent\\\", \\\"Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95/12.0.013; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413\\\"); We don\'t need to run setDetectVar() function in production website. If you implemented HD web service to your homepage and the mobile visitors directly browse others page on your website, it will not redirect them to your mobile website. Hope it\'s helpful.
February 12, 2010 10:07
User photo
support
Handset Detection
Hi, Bill. Thanks for that - although I\'ll do more testing myself because i\'m sure it didn\'t work on an E72 last week. Anyway. As per my other enquiry. In my index.aspx page, i do a call to \'detect\': If (hd.detect(\\\"all\\\")) Then to see if it\'s a mobile phone. Then i make another call to \'detect\' from my mobile page, to get the flash values. Because i\'ve made the call to \'detect\' twice, the stats see it as two hits to my site, even though it\'s only one!! So, should i be making one call to \'detect\' in my index.aspx page, and store the flash version etc in a cookie, to retrieve from the mobile page? Thanks.
February 13, 2010 05:13
User photo
support
Handset Detection
OK - sorted it. I just put the detection code on my home page, retrieved the values i wanted, and passed them using the GET method to my mobile page. Thanks, Bill.
February 14, 2010 01:58
User photo
support
Handset Detection
Great job! Captain Planet.
February 15, 2010 10:41