|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
detecting mobile devices
We have a requirement to 'detect mobile devices'.Don 10/04/11 10:20 A You should be able to compare cgi.HTTP_USER_AGENT to:John M Bliss 10/04/11 10:26 A we sort of have this limitation using html/js only. No coldfusion unfortunately.Don 10/04/11 10:56 A Yes: use WURFL.James Holmes 10/04/11 10:56 A >Yes: use WURFL.Don 10/04/11 11:13 A Honestly, that seems silly to me. If you have to use js then why obfuscateMichael Grant 10/04/11 11:18 A >Honestly, that seems silly to me. If you have to use js then why obfuscateDon 10/04/11 11:28 A > >Honestly, that seems silly to me. If you have to use js then whyDon 10/04/11 11:35 A You're right. I didn't read your reply close enough.Michael Grant 10/04/11 11:50 A This works.Robert Harrison 10/04/11 03:47 P > This works.Dave Watts 10/04/11 05:39 P What are you talking about Dave? It's neatly split into two clauses, andJosh Nathanson 10/04/11 05:45 P > What are you talking about Dave? It's neatly split into two clauses, andLeigh 10/04/11 06:27 P > I do know whether to be scared or impressed that you managed to notice that..Leigh 10/04/11 06:31 P > That looks like it's fun to maintain. Fortunately, there aren't everMoney Pit 06/11/12 03:39 P I know I've already been beaten down for not properly reading the OP's post,Michael Grant 10/04/11 06:59 P In our defense, that limitation was not actually in OP. And he *was* postingJohn M Bliss 10/04/11 07:01 P True true.Michael Grant 10/04/11 07:09 P HTTP_USER_AGENT : String ReReplace (UNFINISHED)RICHARD SIMPSON II 06/10/12 01:40 P This JavaScript value extractor would be pretty easy to translate to CF too:.jonah 06/10/12 07:52 P Hi, Jonah...Rick Faircloth 06/10/12 08:12 P All the projects I'm working on now are "responsive" e.g. using flexible.jonah 06/10/12 08:25 P One problem that I've faced when developing mobile sitesRick Faircloth 06/10/12 09:59 P Have you looked at how jQuery mobile handles it?.jonah 06/11/12 12:17 A Out of curiosity, how are you accounting for desktops with touch interfaces?Judah McAuley 06/11/12 12:13 A I'm not yet. (Don't have any target hardware.) :(.jonah 06/11/12 12:17 A That's been a big challenge to my typical approach toRick Faircloth 06/11/12 11:32 A Sorry I didn't get back to you sooner, Jonah;Rick Faircloth 06/11/12 11:19 A We have a requirement to 'detect mobile devices'. I've done some priliminary research and see some are using WURFL file. Is there anyone here using this? Also was wondering what others have been using for this? and are there any recommendations. Thanks You should be able to compare cgi.HTTP_USER_AGENT to: http://www.zytrax.com/tech/web/mobile_ids.html http://whatsmyuseragent.com/CommonUserAgents.asp etc ...and render accordingly. ----- Excess quoted text cut - see Original Post for more ----- we sort of have this limitation using html/js only. No coldfusion unfortunately. Yes: use WURFL. This might be useful: http://cfwurfl.riaforge.org/ -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 4 October 2011 22:20, Don <danfarmer@hotmail.com> wrote: > > We have a requirement to 'detect mobile devices'. > > ... are there any recommendations. > > >Yes: use WURFL. Does this sound like a resonable solution.... download WURFL file, pick out the specific few things we are looking for and insert that into our database. Then when we get a user-agent that is mobile we could detect that with a query to our db. Honestly, that seems silly to me. If you have to use js then why obfuscate it by adapting cf to js? Why not just approach it with js natively? http://www.hand-interactive.com/resources/detect-mobile-javascript.htm ----- Excess quoted text cut - see Original Post for more ----- >Honestly, that seems silly to me. If you have to use js then why obfuscate >it by adapting cf to js? Why not just approach it with js natively? > >http://www.hand-interactive.com/resources/detect-mobile-javascript.htm Given your description, I'm not sure you have understood the requirement. Given the nature of mobile devices. It would seem that JS is limited in what it can detect. Even that article you mention goes onto suggest WURFL for more succinct data. Also, the article mentions "to be able to detect SOME devices with Javascript" - that's way off to what we want to accomplish. ----- Excess quoted text cut - see Original Post for more ----- Furthermore, that article you mention refers to JS library on MobileESP. But even on The MobileESP project website they state... "and JavaScript for more limited client-side detection." "Important Caveat: The MobileESP project code is lightweight and ideal for many web sites. However, this project is not meant to replace other projects offering greater specificity and control, such as WURFL or HandsetDetection.com." You're right. I didn't read your reply close enough. ----- Excess quoted text cut - see Original Post for more ----- This works. <cfif reFindNoCase("android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",CGI.HTTP_USER_AGENT) GT 0 OR reFindNoCase("1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-",Left(CGI.HTTP_USER_AGENT,4)) GT 0> Yes, I am a mobile device. <cfelse> No, I'm not a mobile device </cfif> Robert B. Harrison Director of Interactive Services Austin & Williams 125 Kennedy Drive, Suite 100 Hauppauge NY 11788 P : 631.231.6600 Ext. 119 F : 631.434.7022 http://www.austin-williams.com Great advertising can't be either/or. It must be &. Plug in to our blog: A&W Unplugged http://www.austin-williams.com/unplugged ----- Excess quoted text cut - see Original Post for more ----- That looks like it's fun to maintain. Fortunately, there aren't ever any new mobile devices. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ http://training.figleaf.com/ Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on GSA Schedule, and provides the highest caliber vendor-authorized instruction at our training centers, online, or What are you talking about Dave? It's neatly split into two clauses, and the 4-letter ones are alphabetized. Ha ha. -- Josh ----- Excess quoted text cut - see Original Post for more ----- > What are you talking about Dave? It's neatly split into two clauses, and > the 4-letter ones are alphabetized. Ha ha. I do know whether to be scared or impressed that you managed to notice that.. -Le > I do know whether to be scared or impressed that you managed to notice that.. Ack. Meant to type: I do *not* know whether to be scared or impressed ... -Leigh > That looks like it's fun to maintain. Fortunately, there aren't ever > any new mobile devices. With any luck its not so bad. That code is the CF version supplied by http://detectmobilebrowsers.com.. Last updated Feb 28 according to the site. The CF version can be had in txt form here http://detectmobilebrowsers.com/download/coldfusion A scheduled cfhttp and a few cfifs, followed by a little replace() magic and a conditional cffile write could keep an include with the latest regex in it updated on a given server. I have to sheepishly admit I have been using the same code for my own corporate site. And yes I compounded the sin by being too lazy to write an auto-updater. Looked into WURFL and at the time it didn't seem accessible enough to me for what I wanted to do in the time I had to do it. -- --m@Robertson-- Janitor, The Robertson Team mysecretbase.com I know I've already been beaten down for not properly reading the OP's post, so it's a bit of the pot calling the kettle black... but he did mention: *"we sort of have this limitation using html/js only. No coldfusion unfortunately."* On Tue, Oct 4, 2011 at 3:47 PM, Robert Harrison <robert@austin-williams.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- In our defense, that limitation was not actually in OP. And he *was* posting to CFTalk after all... :-) On Oct 4, 2011 5:59 PM, "Michael Grant" <mgrant@modus.bz> wrote: > > I know I've already been beaten down for not properly reading the OP's post, ----- Excess quoted text cut - see Original Post for more ----- reFindNoCase("android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge >> |maemo|midp|mmp|opera m(ob|in)i|palm( >> os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows >> (ce|phone)|xda|xiino",CGI.HTTP_USER_AGENT) GT 0 OR >> reFindNoCase("1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a >> wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r >> |s >> )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 >> u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( >> i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( >> |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( >> |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( >> g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| >> |o|v)|zz)|mt(50|p1|v >> )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v >> )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| >> )|webc|whit|wi(g >> |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-",Left(CGI.HTTP_USER_AGENT,4)) ----- Excess quoted text cut - see Original Post for more ----- HTTP_USER_AGENT : String ReReplace (UNFINISHED) <------------------------------------> My idea is to extract each instance before ";" so we can auto detect operating systems, browser versions, and future devices. This data can be placed in a table, xml file, etc. Thus, it can be logged, massaged for css/html5, j-Queried, etc. I'm not sure if this is the best way to do this. But it is worth a spin on some ideas. Thanks and CF STILL ROCKS. <------------------------------------> <!--- REPLACE THE FIRST '(' WITH NOTHING '', CREATING A SPACE ---> <cfset TheString = REReplace(HTTP_USER_AGENT, '\(', '', 'ALL') /> <!-- TheString: #TheString#<br /><br /> --> <!--- REPLACE THE FIRST ')' WITH NOTHING '', CREATING A SPACE ---> <cfset TheString2 = REReplace(TheString, '\)', '', 'ALL') /> <!-- TheString2: #TheString2#<br /><br /> --> <!--- REPLACE THE SPACES ' ' WITH ';', CREATING A ";" SPACER ---> <cfset TheString3 = replace(TheString2, ' ',';', 'ALL') /> <!-- TheString3: #TheString3#<br /><br /> --> <!--- FOUND PROBLEM WITH "Windows;NT;5.1;;" (REPLACE THE ";;" NO PUN INTENDED!) ---> <cfset TheString4 = REReplace(TheString3, '\;;', ';', 'ALL') /> <!-- TheString4: #TheString4#<br /><br /> --> WORKING OUTPUT: Mozilla/5.0;Windows;NT;5.1;rv:2.0.1;Gecko/20100101;Firefox/4.0.1 This JavaScript value extractor would be pretty easy to translate to CF too: http://www.quirksmode.org/js/detect.html On 6/10/12 10:39 AM, RICHARD SIMPS ----- Excess quoted text cut - see Original Post for more ----- Hi, Jonah... Just a quick question... Have you found the method of detecting specific mobile devices to be preferable to "Responsive Web Design"? Interested to know you thoughts and experience. Thanks! Rick This JavaScript value extractor would be pretty easy to translate to CF too: http://www.quirksmode.org/js/detect.html On 6/10/12 10:39 AM, RICHARD SIMPS > HTTP_USER_AGENT : String ReReplace (UNFINISHED) > > <------------------------------------> > My idea is to extract each instance before ";" so we can auto detect operating systems, browser versions, and future devices. This data can be placed in a table, xml file, etc. Thus, it can be logged, massaged for css/html5, j-Queried, etc. ----- Excess quoted text cut - see Original Post for more ----- INTENDED!) ---> ----- Excess quoted text cut - see Original Post for more ----- Mozilla/5.0;Windows;NT;5.1;rv:2.0.1;Gecko/20100101;Firefox/4.0.1 > > > All the projects I'm working on now are "responsive" e.g. using flexible layouts and media queries. However, there are always going to be certain elements or features that you can't just reflow and have be an optimal experience for both mobile and desktop. (e.g. touch and mouse/keyboard) so, being able to know what kind of device you're serving to allows you to optimize things further by serving up the appropriate stuff. On 6/10/12 5:11 PM, Rick Faircloth wrote: ----- Excess quoted text cut - see Original Post for more ----- One problem that I've faced when developing mobile sites that utilize touch instead of mouse click is with stopping elements underneath the screen overlay from reacting to a touch. It seems that a touch will penetrate to any layer under a screen overlay. I haven't found a solution to this problem other than to us JS to set the <body> css to "display:none" while the overlay is in place. Is there a simpler way? Rick All the projects I'm working on now are "responsive" e.g. using flexible layouts and media queries. However, there are always going to be certain elements or features that you can't just reflow and have be an optimal experience for both mobile and desktop. (e.g. touch and mouse/keyboard) so, being able to know what kind of device you're serving to allows you to optimize things further by serving up the appropriate stuff. On 6/10/12 5:11 PM, Rick Faircloth wrote: ----- Excess quoted text cut - see Original Post for more ----- too: ----- Excess quoted text cut - see Original Post for more ----- Have you looked at how jQuery mobile handles it? On 6/10/12 6:59 PM, Rick Faircloth wrote: ----- Excess quoted text cut - see Original Post for more ----- Out of curiosity, how are you accounting for desktops with touch interfaces? cheers, Judah ----- Excess quoted text cut - see Original Post for more ----- I'm not yet. (Don't have any target hardware.) :( I would hope that the same touch events are fired in the desktop versions of the browsers. Otherwise it'd be just mean making sure your app uses click but not hover events. On 6/10/12 9:12 PM, Judah McAuley wrote: ----- Excess quoted text cut - see Original Post for more ----- That's been a big challenge to my typical approach to interface design when incorporating mobile touch devices: lack of hover. I recently began to redesign one of my customers' desktop site (while I'm still working on the transition and pros and cons to responsive web design and its impact on my income stream... :o) and the main menu was designed around a full-width menu dropdown menu panel. Once the panel dropped down after a click on the main menu item, a user could hover over various selections and see a brief description of the content they would encounter if they clicked the submenu option. I realized, fairly late in the development of the menu, that this approach would not work with 10" tablet devices which lacked the ability to hover. So, since this is not currently a responsive design, but separate desktop and mobile sites, I relied on the desktop site to serve the 10" tablet users...not good when your main navigation won't work for them. So, I'm tweaking that menu to only respond to clicks. It's a great limitation on the functionality and effectiveness of the menu design, but necessary. Perhaps we need a form of touch, like "long touch, short click" or something to imitate hover on touch platforms. I'd had to see hover disappear altogether, and put users in a position to only find out what's behind the curtains without clicking and actually going to another page of content. We lose "preview" ability with no hover or at least create the need for two clicks, one to see the preview and another to see the content, if we have to rely only on clicking/touching. I'm not yet. (Don't have any target hardware.) :( I would hope that the same touch events are fired in the desktop versions of the browsers. Otherwise it'd be just mean making sure your app uses click but not hover events. On 6/10/12 9:12 PM, Judah McAuley wrote: > Out of curiosity, how are you accounting for desktops with touch interfaces? ----- Excess quoted text cut - see Original Post for more ----- Sorry I didn't get back to you sooner, Jonah; it was past my bedtime here on the East Coast of the US. :o) Anyway, really haven't given any thought to desktops with touch interfaces. That's something I'll have to add into the mix, however. It was once the software (browsers) that web designers/developers had to wrestle with mostly, now it seems that the hardware has become as much, if not more of a challenge. Out of curiosity, how are you accounting for desktops with touch interfaces? cheers, Judah ----- Excess quoted text cut - see Original Post for more -----
|
May 22, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||