Re: [WebDNA] I'm stuck... :-(

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 102613
interpreted = N
texte = --Apple-Mail-3-680614936 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit This is a nice collection of mobile browser identifiers. Thanks for sharing. This provides a good opportunity for me to soapbox a little bit regarding code optimization and the use of URL and comment contexts. I'm not sure how you're using this, but it looks like it might be something that gets executed very often. It is important to note the performance hit that comes up for every WebDNA tag that gets called. Every [url] context, every [!] context, etc. takes up a little bit of processor time. With a lengthy list of contexts as you have listed here, if this is in something like a header file that gets called on every page, removing extra contexts can result in a noticeable performance improvement. To optimize this code, I would start by only URL'ing the browsername once, storing the URL'ed version in a text variable and using that in the if statement. Next, I would remove all of the comment tags. I just ran a test to verify this, and you can have line breaks and spaces between the parenthetical logical expressions and the IF context still works properly. Finally, I would only URL the items on the right side of the expressions if necessary. In the list you show, this would only be those items that contain spaces, since those would be converted to %20 by the URL and you need that done on both sides of the expression. Dashes, periods, forward-slashes, letters and digits are not affected by URL, so you can skip the URL context on those. The optimized version would look like this: [text]uBrowser=[url][browsername][/url][/text] [if ("[uBrowser]"^"iPhone") | ("[uBrowser]"^"Blackberry") | ("[uBrowser]" ^ "Samsung") | ("[uBrowser]" ^ "Motorola") | ("[uBrowser]" ^ "HTC") | ("[uBrowser]" ^ "Casio") | ("[uBrowser]" ^ "Orange") | ("[uBrowser]" ^ "T-Mobile") | ("[uBrowser]" ^ "[url]Pocket PC[/url]") | ("[uBrowser]" ^ "[url]Opera Mini[/url]") | ("[uBrowser]" ^ "Sharp") | ("[uBrowser]" ^ "Cingular") | ("[uBrowser]" ^ "SonyEricsson") | ("[uBrowser]" ^ "Palm") | ("[uBrowser]" ^ "[url]Windows CE[/url]") | ("[uBrowser]" ^ "[url]Mobile Content Viewer[/url]") | ("[uBrowser]" ^ "[url]Google CHTML Proxy[/url]") | ("[uBrowser]" ^ "Palmsource") | ("[uBrowser]" ^ "Nokia") | ("[uBrowser]" ^ "Smartphone") | ("[uBrowser]" ^ "[url]Opera 3.62[/url]") | ("[uBrowser]" ^ "lg-") | ("[uBrowser]" ^ "sie-") | ("[uBrowser]" ^ "up.b") | ("[uBrowser]" ^ "up/")| ("[uBrowser]" ^ "Reqwirelessweb") ] [then][text]celldetected=T[/text][/then] [else][text]celldetected=[/text][/else] [/if] [showif [celldetected]=T]redirect or do something here[/showif] For comparison, I put the original code inside a [loop start=1&end=100] context and dumped the elapsed time afterwords, and it took 17 ticks. I tried it again with my optimized version and it took 8 ticks to execute 100 times. That's better than a 50% improvement. On a low traffic or rarely accessed page, this wouldn't make a lot of difference, but on a high traffic page the difference is very apparent. Brian Fries BrainScan Software Brian Fries BrainScan Software On May 23, 2009, at 4:50 PM, Psi Prime, Matthew A Perosi wrote: > I'm following up on this 2 month old thread for the benefit of the > community, with new information after some extensive testing on > my .mobi website. > > The code the Rod provided below works very well, but it is missing 4 > browser types. > The missing types are lg-, sie-, up.b and up/ > Also I found the IF statement to be flaky without the full use of > the [url] context of the right side of each ^ > > Here is my rewritten, tested code that works as of today, May 23, > 2009. > The [!][/!] have only been added for ease of reading on email and > archives. > ------------------------------- > [if ("[url][browsername][/url]" ^ "[url]iPhone[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Blackberry[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Samsung[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Motorola[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]HTC[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Casio[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Orange[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]T-Mobile[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Pocket PC[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Opera Mini[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Sharp[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Cingular[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]SonyEricsson[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Palm[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Windows CE[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Mobile Content Viewer[/ > url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Google CHTML Proxy[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Palmsource[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Nokia[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Smartphone[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Opera 3.62[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]lg-[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]sie-[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]up.b[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]up/[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Reqwirelessweb[/url]")] > [then][text]celldetected=T[/text][/then] > [else][text]celldetected=[/text][/else] > [/if] > [showif [celldetected]=T]redirect or do something here[/showif] > -------------------------------------------- > > > Matthew A Perosi JewelerWebsites.com > ------------------------------by Psi Prime------- > Senior Web Developer 323 Union Blvd. > Totowa, NJ 07512 > Pre-Sales: 888.872.0274 > Service: 973.413.8213 > Training: 973.413.8214 > Fax: 973.413.8217 > > http://www.jewelerwebsites.com > http://en.wikipedia.org/wiki/Psi_Prime%2C_Inc > http://www.psiprime.com > > > Michael A. DeLorenzo wrote: >> >> OK...Now it comes up with the mobile page and properly detects my >> Android >> OS. >> >> -----Original Message----- >> From: Rob [mailto:rforest@mac.com] >> Sent: Thursday, March 26, 2009 10:31 AM >> To: talk@webdna.us >> Subject: Re: [WebDNA] I'm stuck... :-( >> >> Mike, >> >> This is because the first one defaulted to the home page, I didn't >> have Android in there yet.. :-(. >> >> Fixed ... added to both... >> >> The phone section doesn't contain any flash. >> >> Rob >> >> >> On 26-Mar-09, at 7:33 AM, Michael A. DeLorenzo wrote: >> >> >>> First worked but my phone did not load the flash. >>> >>> Second did not work at all. >>> >>> T-Mobile G1 with Android >>> >>> Mike >>> >>> -----Original Message----- >>> From: Rob [mailto:rforest@mac.com] >>> Sent: Wednesday, March 25, 2009 7:20 PM >>> To: talk@webdna.us >>> Subject: Re: [WebDNA] I'm stuck... :-( >>> >>> Here is a test of both methods if anyone wants to confirm: >>> >>> Using REFERRER >>> http://kalvanna.com/mobile2.dna >>> >>> Using GETMIMEHEADER >>> http://kalvanna.com/mobile3.dna >>> >>> Not sure why the second one didn't work with the iphone... :-( .. >>> would have been a heck of a lot easier... >>> >>> Rob >>> >>> On 25-Mar-09, at 5:03 PM, Rob wrote: >>> >>> >>>> Just tried this on the Iphone... doesn't seem to detect it... :-( >>>> >>>> Rob >>>> >>>> >>>> On 25-Mar-09, at 4:52 PM, Psi Prime, Matthew A Perosi wrote: >>>> >>>> >>>>> I'm using this code right now. >>>>> I have not tested it on every phone imaginable, but it seems to >>>>> work for most smart phones I've tested.... Although it's not >>>>> tested >>>>> on the iPhone. >>>>> >>>>> [text]accept=[GETMIMEHEADER name=Accept][/text] >>>>> [text]celldetected=[/text] >>>>> [showif [url][accept][/url]=[url]text/vnd.wap.wml[/url]] >>>>> [text]wapagent=T[/text] >>>>> [/showif] >>>>> [showif [wapagent]=T] >>>>> [text]celldetected=T[/text] >>>>> [/showif] >>>>> [showif [celldetected]=T] >>>>> [redirect url=/mobi/index.tpl] >>>>> [/showif] >>>>> >>>>> Matthew A Perosi JewelerWebsites.com >>>>> ------------------------------by Psi Prime------- >>>>> Senior Web Developer 323 Union Blvd. >>>>> Totowa, NJ 07512 >>>>> Pre-Sales: 888.872.0274 >>>>> Service: 973.413.8213 >>>>> Training: 973.413.8214 >>>>> Fax: 973.413.8217 >>>>> >>>>> http://www.jewelerwebsites.com >>>>> http://en.wikipedia.org/wiki/Psi_Prime%2C_Inc >>>>> http://www.psiprime.com >>>>> >>>>> >>>>> >>>>> Rob wrote: >>>>> >>>>>> Dan, >>>>>> >>>>>> I just got involved due to a technical request, and haven't had >>>>>> much to do with the site involved. I think its just being handled >>>>>> generically, much like yours. I did notice on the newer >>>>>> blackberry's and iphones, it renders correctly, but on the older >>>>>> styles a lot of positional elements are off. It looks like its >>>>>> just set to a standard width of 320. I know the person working on >>>>>> it is on this list, and its up to him if he wishes to expand on >>>>>> it >>>>>> more. >>>>>> >>>>>> The detection was actually the easy part, and even easier now >>>>>> with >>>>>> the list help. I would imagine you could expand on it and detect >>>>>> size as well, but that would probably take a few hours to dump >>>>>> them all in, and months to find them all. With the shelf live of >>>>>> must phones, I think we'll just stick to the newer versions. Here >>>>>> is a link to the file I used, but for the most part, I went thru >>>>>> some of the server logs for the site involved, as the list didn't >>>>>> seem up to date. I haven't even heard of half these things.... >>>>>> >>>>>> http://homepage.mac.com/rforest/downloads/mobile.zip >>>>>> >>>>>> More info, as well as files, at this link: >>>>>> >>>>>> >> http://studiohyperset.wordpress.com/2007/02/05/mobile-redirect-code-discussi >> >>> on-index/ >>> >>>>>> And what I'm currently using is this: >>>>>> --------------- >>>>>> [If ("[url][browsername][/url]" ^ "iPhone")|("[url][browsername] >>>>>> [/ >>>>>> url]" ^ "Blackberry")|("[url][browsername][/url]" ^ "Samsung")| >>>>>> ("[url][browsername][/url]" ^ "Motorola")|("[url][browsername][/ >>>>>> url]" ^ "HTC")|("[url][browsername][/url]" ^ "Casio")|("[url] >>>>>> [browsername][/url]" ^ "Orange")|("[url][browsername][/url]" ^ >>>>>> "T- >>>>>> Mobile")|("[url][browsername][/url]" ^ "Pocket PC")|("[url] >>>>>> [browsername][/url]" ^ "Opera Mini")|("[url][browsername][/ >>>>>> url]" ^ >>>>>> "Sharp")|("[url][browsername][/url]" ^ "Cingular")|("[url] >>>>>> [browsername][/url]" ^ "SonyEricsson")|("[url][browsername][/ >>>>>> url]" >>>>>> ^ "Palm")|("[url][browsername][/url]" ^ "Windows CE")|("[url] >>>>>> [browsername][/url]" ^ "Mobile Content Viewer")|("[url] >>>>>> [browsername][/url]" ^ "Google CHTML Proxy")|("[url] >>>>>> [browsername][/ >>>>>> url]" ^ "Palmsource")|("[url][browsername][/url]" ^ "Nokia")| >>>>>> ("[url][browsername][/url]" ^ "Smartphone")|("[url][browsername] >>>>>> [/ >>>>>> url]" ^ "Opera 3.62")|("[url][browsername][/url]" ^ >>>>>> "Reqwirelessweb")] >>>>>> [Then][REDIRECT url=mobile/index.html][/Then] >>>>>> [Else] Alternate redirect here, or leave blank if its self [/ >>>>>> Else] >>>>>> [/if] >>>>>> ------------------- >>>>>> >>>>>> Sure would be nice to see some type of standardization for this >>>>>> area in that industry. ... :-( >>>>>> >>>>>> Rob >>>>>> >>>>>> >>>>>> On 25-Mar-09, at 3:49 PM, Dan Strong wrote: >>>>>> >>>>>> >>>>>>> Rob, >>>>>>> >>>>>>> I'm curious how you (or anyone for that matter) is/are handling >>>>>>> detection of other mobile devices. I have tried (and not yet >>>>>>> resolved) a way to catch all (or as many) mobile devices as I >>>>>>> can >>>>>>> so I can serve mobile-friendly content. >>>>>>> >>>>>>> 1) I've thought about using the WRFL data source ( >>>>>>> >>> http://wurfl.sourceforge.net/ >>> >>>>>>> ) but it contains a lot of irrelevant (for my purposes) data and >>>>>>> would require what appears to be a great deal of work and >>>>>>> constant upkeep, and/or >>>>>>> >>>>>>> 2) http://detectmobilebrowsers.mobi/ - php script. Haven't tried >>>>>>> it. Not against using php when I need to, but I try to do things >>>>>>> via WebDNA. >>>>>>> >>>>>>> 2) Detecting screen-size via javascript (if screen size is >>>>>>> under, >>>>>>> say, 400px wide then serve mobile.css) ... but that won't always >>>>>>> work since not all mobile devices speak javascript... >>>>>>> >>>>>>> For now I'm doing like you are and detecting the most popular >>>>>>> devices, but I'd really love to be able to catch them all. It >>>>>>> would be nice if all mobile devices would add a standard >>>>>>> descriptor to their USER AGENT header, like --mobile-- or >>>>>>> somethinglike that. Anyhow, like I said, just curious. >>>>>>> >>>>>>> ** Cue the programmer with the "duh, you do it like this with a >>>>>>> single line of code" response ** >>>>>>> -Dan >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, 25 Mar 2009 14:55:29 -0600 >>>>>>> Rob wrote: >>>>>>> >>>>>>>> Yup.... Got it... Thanks.. >>>>>>>> Works perfect! ... Thanks for all the help... >>>>>>>> Rob >>>>>>>> On 25-Mar-09, at 2:16 PM, Donovan Brooke wrote: >>>>>>>> >>>>>>>>> Rob wrote: >>>>>>>>> >>>>>>>>>> Darn.... I gotta remember to use the online docs instead of >>>>>>>>>> my own... got to used to working alone before the >>>>>>>>>> revival .. ;-) >>>>>>>>>> Thanks Paul... >>>>>>>>>> >>>>>>>>> You will want to encode browsername most likely.. >>>>>>>>> >>>>>>>>> [if "[url][browsername][/url]"... >>>>>>>>> >>>>>>>>> >>>>>>>>> Donovan >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Donovan D. Brooke PH: 1 (608) 770-3822 >>>>>>>>> ------------------------------------------------ >>>>>>>>> VP >>>>>>>>> WebDNA Software Corporation >>>>>>>>> 16192 Coastal Highway >>>>>>>>> Lewes, DE 19958 >>>>>>>>> --------------------------------------------------------- --Apple-Mail-3-680614936 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
This is a nice collection = of mobile browser identifiers. Thanks for = sharing.

This provides a good opportunity for = me to soapbox a little bit regarding code optimization and the use of = URL and comment contexts.

I'm not sure how you're = using this, but it looks like it might be something that gets executed = very often. It is important to note the performance hit that comes up = for every WebDNA tag that gets called.  Every [url] context, every = [!] context, etc. takes up a little bit of processor time. With a = lengthy list of contexts as you have listed here, if this is in = something like a header file that gets called on every page, removing = extra contexts can result in a noticeable performance = improvement.

To optimize this code, I would start by = only URL'ing the browsername once, storing the URL'ed version in a text = variable and using that in the if = statement.

Next, I would remove all of the = comment tags. I just ran a test to verify this, and you can have line = breaks and spaces between the parenthetical logical expressions and the = IF context still works properly.

Finally, I = would only URL the items on the right side of the expressions if = necessary. In the list you show, this would only be those items that = contain spaces, since those would be converted to %20 by the URL and you = need that done on both sides of the expression. Dashes, periods, = forward-slashes, letters and digits are not affected by URL, so you can = skip the URL context on those.

The optimized = version would look like = this:

[text]uBrowser=3D[url][browsername][/url][/= text]
[if ("[uBrowser]"^"iPhone") = |
  ("[uBrowser]"^"Blackberry") |
  ("[uBrowser]" ^ = "Samsung") |
  ("[uBrowser]" ^ = "Motorola") |
  ("[uBrowser]" ^ = "HTC") |
  ("[uBrowser]" ^ = "Casio") |
  ("[uBrowser]" ^ = "Orange") |
  ("[uBrowser]" ^ = "T-Mobile") |
  ("[uBrowser]" ^ "[url]Pocket = PC[/url]") |
  ("[uBrowser]" ^ "[url]Opera = Mini[/url]") |
  ("[uBrowser]" ^ = "Sharp") |
  ("[uBrowser]" ^ = "Cingular") |
  ("[uBrowser]" ^ = "SonyEricsson") |
  ("[uBrowser]" ^ = "Palm") |
  ("[uBrowser]" ^ "[url]Windows = CE[/url]") |
  ("[uBrowser]" ^ "[url]Mobile Content = Viewer[/url]") |
  ("[uBrowser]" ^ "[url]Google CHTML = Proxy[/url]") |
  ("[uBrowser]" ^ = "Palmsource") |
  ("[uBrowser]" ^ = "Nokia") |
  ("[uBrowser]" ^ = "Smartphone") |
  ("[uBrowser]" ^ "[url]Opera = 3.62[/url]") |
  ("[uBrowser]" ^ = "lg-") |
  ("[uBrowser]" ^ = "sie-") |
  ("[uBrowser]" ^ = "up.b") |
  ("[uBrowser]" ^ = "up/")|
  ("[uBrowser]" ^ = "Reqwirelessweb")
]
[then][text]celldetected=3DT[/text][/then]
[else]= [text]celldetected=3D[/text][/else]
[/if]
[showif = [celldetected]=3DT]redirect or do something here[/showif]


For = comparison, I put the original code inside a [loop start=3D1&end=3D100= ] context and dumped the elapsed time afterwords, and it took 17 ticks. = I tried it again with my optimized version and it took 8 ticks to = execute 100 times. That's better than a 50% improvement.

On a low traffic or rarely accessed page, this wouldn't = make a lot of difference, but on a high traffic page the difference is = very apparent.

Brian = Fries
BrainScan Software


Brian = Fries
BrainScan Software


On May = 23, 2009, at 4:50 PM, Psi Prime, Matthew A Perosi wrote:

I'm following up on this 2 month = old thread for the benefit of the community, with new information after = some extensive testing on my .mobi website.

The code the Rod = provided below works very well, but it is missing 4 browser types.
= The missing types are lg-, sie-, up.b and up/
Also I found the IF = statement to be flaky without the full use of the [url] context of the = right side of each ^

Here is my rewritten, tested code that = works as of today, May 23, 2009. 
The [!][/!] have only been = added for ease of reading on email and archives.
= -------------------------------
[if ("[url][browsername][/url]" ^ = "[url]iPhone[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Blackberry[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Samsung[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Motorola[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]HTC[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Casio[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Orange[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]T-Mobile[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Pocket PC[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Opera Mini[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Sharp[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Cingular[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]SonyEricsson[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Palm[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Windows CE[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Mobile Content Viewer[/url]")|[!]
= [/!]("[url][browsername][/url]" ^ "[url]Google CHTML = Proxy[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Palmsource[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Nokia[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Smartphone[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Opera 3.62[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]lg-[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]sie-[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]up.b[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]up/[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Reqwirelessweb[/url]")]
= [then][text]celldetected=3DT[/text][/then]
= [else][text]celldetected=3D[/text][/else]
[/if]
[showif = [celldetected]=3DT]redirect or do something here[/showif]
= --------------------------------------------


Matthew A Perosi            =JewelerWebsites.com------------------------------by Psi Prime-------Senior Web Developer             323 Union Blvd.                                 Totowa, NJ 07512Pre-Sales: 888.872.0274Service:   973.413.8213Training:  973.413.8214Fax:       973.413.8217http://www.jewelerwebsites.com=http://en.wikipedia=.org/wiki/Psi_Prime%2C_Inchttp://www.psiprime.com

=
Michael A. DeLorenzo wrote:
OK...Now it comes up with the mobile page and properly detects =my AndroidOS.-----Original Message-----From: Rob [mailto:rforest@mac.com]=20Sent: Thursday, March 26, 2009 10:31 AMTo: talk@webdna.usSubject: Re: [WebDNA] I'm stuck... :-(Mike,This is because the first one defaulted to the home page, I didn't =20have Android in there yet.. :-(.Fixed ... added to both...The phone section doesn't contain any flash.RobOn 26-Mar-09, at 7:33 AM, Michael A. DeLorenzo wrote:  
First worked but =my phone did not load the flash.Second did not work at all.T-Mobile G1 with AndroidMike-----Original Message-----From: Rob [mailto:rforest@mac.com]Sent: Wednesday, March 25, 2009 7:20 PMTo: talk@webdna.usSubject: Re: [WebDNA] I'm stuck... :-(Here is a test of both methods if anyone wants to confirm:Using REFERRERhttp://kalvanna.com/mobile2.dnaUsing GETMIMEHEADERhttp://kalvanna.com/mobile3.dnaNot sure why the second one didn't work with the iphone... :-( ..would have been a heck of a lot easier...RobOn 25-Mar-09, at 5:03 PM, Rob wrote:    
Just tried =this on the Iphone... doesn't seem to detect it... :-(RobOn 25-Mar-09, at 4:52 PM, Psi Prime, Matthew A Perosi wrote:      
I'm =using this code right now.I have not tested it on every phone imaginable, but it seems towork for most smart phones I've tested.... Although it's not testedon the iPhone.[text]accept=3D[GETMIMEHEADER name=3DAccept][/text][text]celldetected=3D[/text][showif [url][accept][/url]=3D[url]text/vnd.wap.wml[/url]][text]wapagent=3DT[/text][/showif][showif [wapagent]=3DT][text]celldetected=3DT[/text][/showif][showif [celldetected]=3DT][redirect url=3D/mobi/index.tpl][/showif]Matthew A Perosi            JewelerWebsites.com------------------------------by Psi Prime-------Senior Web Developer             323 Union Blvd.                             Totowa, NJ 07512Pre-Sales: 888.872.0274Service:   973.413.8213Training:  973.413.8214Fax:       973.413.8217http://www.jewelerwebsites.com=http://en.wikipedia=.org/wiki/Psi_Prime%2C_Inchttp://www.psiprime.comRob wrote:        
Dan,I just got involved due to a technical request, and haven't hadmuch to do with the site involved. I think its just being handledgenerically, much like yours. I did notice on the newerblackberry's and iphones, it renders correctly, but on the olderstyles a lot of positional elements are off. It looks like itsjust set to a standard width of 320. I know the person working onit is on this list, and its up to him if he wishes to expand on itmore.The detection was actually the easy part, and even easier now withthe list help. I would imagine you could expand on it and detectsize as well, but that would probably take a few hours to dumpthem all in, and months to find them all. With the shelf live ofmust phones, I think we'll just stick to the newer versions. Hereis a link to the file I used, but for the most part, I went thrusome of the server logs for the site involved, as the list didn'tseem up to date. I haven't even heard of half these things....http://homep=age.mac.com/rforest/downloads/mobile.zipMore info, as well as files, at this link:          
=
http://studiohyperset.wordpress.com/2007/02/05/mobile-redirect=-code-discussi  
on-index/    
=
And what I'm =currently using is this:---------------[If ("[url][browsername][/url]" ^ "iPhone")|("[url][browsername][/url]" ^ "Blackberry")|("[url][browsername][/url]" ^ "Samsung")|("[url][browsername][/url]" ^ "Motorola")|("[url][browsername][/url]" ^ "HTC")|("[url][browsername][/url]" ^ "Casio")|("[url][browsername][/url]" ^ "Orange")|("[url][browsername][/url]" ^ "T-Mobile")|("[url][browsername][/url]" ^ "Pocket PC")|("[url][browsername][/url]" ^ "Opera Mini")|("[url][browsername][/url]" ^"Sharp")|("[url][browsername][/url]" ^ "Cingular")|("[url][browsername][/url]" ^ "SonyEricsson")|("[url][browsername][/url]"^ "Palm")|("[url][browsername][/url]" ^ "Windows CE")|("[url][browsername][/url]" ^ "Mobile Content Viewer")|("[url][browsername][/url]" ^ "Google CHTML Proxy")|("[url][browsername][/url]" ^ "Palmsource")|("[url][browsername][/url]" ^ "Nokia")|("[url][browsername][/url]" ^ "Smartphone")|("[url][browsername][/url]" ^ "Opera 3.62")|("[url][browsername][/url]" ^"Reqwirelessweb")][Then][REDIRECT url=3Dmobile/index.html][/Then][Else] Alternate redirect here, or leave blank if its self [/Else][/if]-------------------Sure would be nice to see some type of standardization for thisarea in that industry. ... :-(RobOn 25-Mar-09, at 3:49 PM, Dan Strong wrote:          
Rob,I'm curious how you (or anyone for that matter) is/are handlingdetection of other mobile devices. I have tried (and not yetresolved) a way to catch all (or as many) mobile devices as I canso I can serve mobile-friendly content.1) I've thought about using the WRFL data source (            
=
http://wurfl.sourceforge.net/    
=
=
) but it contains a lot of irrelevant (for my =purposes) data andwould require what appears to be a great deal of work andconstant upkeep, and/or2) http://detectmobilebrowsers.mob=i/ - php script. Haven't triedit. Not against using php when I need to, but I try to do thingsvia WebDNA.2) Detecting screen-size via javascript (if screen size is under,say, 400px wide then serve mobile.css) ... but that won't alwayswork since not all mobile devices speak javascript...For now I'm doing like you are and detecting the most populardevices, but I'd really love to be able to catch them all. Itwould be nice if all mobile devices would add a standarddescriptor to their USER AGENT header, like --mobile-- orsomethinglike that. Anyhow, like I said, just curious.** Cue the programmer with the "duh, you do it like this with asingle line of code" response **-DanOn Wed, 25 Mar 2009 14:55:29 -0600Rob <rforest@mac.com> wrote:            
=
Yup.... Got it... Thanks..Works perfect! ... Thanks for all the help...RobOn 25-Mar-09, at 2:16 PM, Donovan Brooke wrote:              
=
Rob wrote:                
=
Darn.... I gotta remember to use the online docs =instead ofmy  own... got to used to working alone before therevival .. ;-)Thanks Paul...                  
=
You will want to encode browsername most likely..[if "[url][browsername][/url]"...Donovan--=20Donovan D. Brooke       PH: 1 (608) 770-3822------------------------------------------------VPWebDNA Software Corporation16192 Coastal HighwayLewes, DE 19958---------------------------------------------------------=

= --Apple-Mail-3-680614936-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] I'm stuck... :-( (Brian Fries 2009)
  2. Re: [WebDNA] I'm stuck... :-( ("Psi Prime, Matthew A Perosi " 2009)
  3. RE: [WebDNA] I'm stuck... :-( ("Michael A. DeLorenzo" 2009)
  4. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  5. RE: [WebDNA] I'm stuck... :-( ("Michael A. DeLorenzo" 2009)
  6. Re: [WebDNA] I'm stuck... :-( (Steve Craig 2009)
  7. Re: [WebDNA] I'm stuck... :-( ( 2009)
  8. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  9. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  10. Re: [WebDNA] I'm stuck... :-( (Bob Minor 2009)
  11. Re: [WebDNA] I'm stuck... :-( ( 2009)
  12. Re: [WebDNA] I'm stuck... :-( ("Psi Prime, Matthew A Perosi " 2009)
  13. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  14. Re: [WebDNA] I'm stuck... :-( ("Dan Strong" 2009)
  15. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  16. Re: [WebDNA] I'm stuck... :-( (Donovan Brooke 2009)
  17. Re: [WebDNA] I'm stuck... :-( (Rob 2009)
  18. Re: [WebDNA] I'm stuck... :-( (Paul Willis 2009)
  19. [WebDNA] I'm stuck... :-( (Rob 2009)
--Apple-Mail-3-680614936 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit This is a nice collection of mobile browser identifiers. Thanks for sharing. This provides a good opportunity for me to soapbox a little bit regarding code optimization and the use of URL and comment contexts. I'm not sure how you're using this, but it looks like it might be something that gets executed very often. It is important to note the performance hit that comes up for every WebDNA tag that gets called. Every [url] context, every [!] context, etc. takes up a little bit of processor time. With a lengthy list of contexts as you have listed here, if this is in something like a header file that gets called on every page, removing extra contexts can result in a noticeable performance improvement. To optimize this code, I would start by only URL'ing the browsername once, storing the URL'ed version in a text variable and using that in the if statement. Next, I would remove all of the comment tags. I just ran a test to verify this, and you can have line breaks and spaces between the parenthetical logical expressions and the IF context still works properly. Finally, I would only URL the items on the right side of the expressions if necessary. In the list you show, this would only be those items that contain spaces, since those would be converted to %20 by the URL and you need that done on both sides of the expression. Dashes, periods, forward-slashes, letters and digits are not affected by URL, so you can skip the URL context on those. The optimized version would look like this: [text]uBrowser=[url][browsername][/url][/text] [if ("[uBrowser]"^"iPhone") | ("[uBrowser]"^"Blackberry") | ("[uBrowser]" ^ "Samsung") | ("[uBrowser]" ^ "Motorola") | ("[uBrowser]" ^ "HTC") | ("[uBrowser]" ^ "Casio") | ("[uBrowser]" ^ "Orange") | ("[uBrowser]" ^ "T-Mobile") | ("[uBrowser]" ^ "[url]Pocket PC[/url]") | ("[uBrowser]" ^ "[url]Opera Mini[/url]") | ("[uBrowser]" ^ "Sharp") | ("[uBrowser]" ^ "Cingular") | ("[uBrowser]" ^ "SonyEricsson") | ("[uBrowser]" ^ "Palm") | ("[uBrowser]" ^ "[url]Windows CE[/url]") | ("[uBrowser]" ^ "[url]Mobile Content Viewer[/url]") | ("[uBrowser]" ^ "[url]Google CHTML Proxy[/url]") | ("[uBrowser]" ^ "Palmsource") | ("[uBrowser]" ^ "Nokia") | ("[uBrowser]" ^ "Smartphone") | ("[uBrowser]" ^ "[url]Opera 3.62[/url]") | ("[uBrowser]" ^ "lg-") | ("[uBrowser]" ^ "sie-") | ("[uBrowser]" ^ "up.b") | ("[uBrowser]" ^ "up/")| ("[uBrowser]" ^ "Reqwirelessweb") ] [then][text]celldetected=T[/text][/then] [else][text]celldetected=[/text][/else] [/if] [showif [celldetected]=T]redirect or do something here[/showif] For comparison, I put the original code inside a [loop start=1&end=100] context and dumped the elapsed time afterwords, and it took 17 ticks. I tried it again with my optimized version and it took 8 ticks to execute 100 times. That's better than a 50% improvement. On a low traffic or rarely accessed page, this wouldn't make a lot of difference, but on a high traffic page the difference is very apparent. Brian Fries BrainScan Software Brian Fries BrainScan Software On May 23, 2009, at 4:50 PM, Psi Prime, Matthew A Perosi wrote: > I'm following up on this 2 month old thread for the benefit of the > community, with new information after some extensive testing on > my .mobi website. > > The code the Rod provided below works very well, but it is missing 4 > browser types. > The missing types are lg-, sie-, up.b and up/ > Also I found the IF statement to be flaky without the full use of > the [url] context of the right side of each ^ > > Here is my rewritten, tested code that works as of today, May 23, > 2009. > The [!][/!] have only been added for ease of reading on email and > archives. > ------------------------------- > [if ("[url][browsername][/url]" ^ "[url]iPhone[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Blackberry[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Samsung[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Motorola[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]HTC[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Casio[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Orange[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]T-Mobile[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Pocket PC[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Opera Mini[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Sharp[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Cingular[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]SonyEricsson[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Palm[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Windows CE[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Mobile Content Viewer[/ > url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Google CHTML Proxy[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Palmsource[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Nokia[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Smartphone[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Opera 3.62[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]lg-[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]sie-[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]up.b[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]up/[/url]")|[!] > [/!]("[url][browsername][/url]" ^ "[url]Reqwirelessweb[/url]")] > [then][text]celldetected=T[/text][/then] > [else][text]celldetected=[/text][/else] > [/if] > [showif [celldetected]=T]redirect or do something here[/showif] > -------------------------------------------- > > > Matthew A Perosi JewelerWebsites.com > ------------------------------by Psi Prime------- > Senior Web Developer 323 Union Blvd. > Totowa, NJ 07512 > Pre-Sales: 888.872.0274 > Service: 973.413.8213 > Training: 973.413.8214 > Fax: 973.413.8217 > > http://www.jewelerwebsites.com > http://en.wikipedia.org/wiki/Psi_Prime%2C_Inc > http://www.psiprime.com > > > Michael A. DeLorenzo wrote: >> >> OK...Now it comes up with the mobile page and properly detects my >> Android >> OS. >> >> -----Original Message----- >> From: Rob [mailto:rforest@mac.com] >> Sent: Thursday, March 26, 2009 10:31 AM >> To: talk@webdna.us >> Subject: Re: [WebDNA] I'm stuck... :-( >> >> Mike, >> >> This is because the first one defaulted to the home page, I didn't >> have Android in there yet.. :-(. >> >> Fixed ... added to both... >> >> The phone section doesn't contain any flash. >> >> Rob >> >> >> On 26-Mar-09, at 7:33 AM, Michael A. DeLorenzo wrote: >> >> >>> First worked but my phone did not load the flash. >>> >>> Second did not work at all. >>> >>> T-Mobile G1 with Android >>> >>> Mike >>> >>> -----Original Message----- >>> From: Rob [mailto:rforest@mac.com] >>> Sent: Wednesday, March 25, 2009 7:20 PM >>> To: talk@webdna.us >>> Subject: Re: [WebDNA] I'm stuck... :-( >>> >>> Here is a test of both methods if anyone wants to confirm: >>> >>> Using REFERRER >>> http://kalvanna.com/mobile2.dna >>> >>> Using GETMIMEHEADER >>> http://kalvanna.com/mobile3.dna >>> >>> Not sure why the second one didn't work with the iphone... :-( .. >>> would have been a heck of a lot easier... >>> >>> Rob >>> >>> On 25-Mar-09, at 5:03 PM, Rob wrote: >>> >>> >>>> Just tried this on the Iphone... doesn't seem to detect it... :-( >>>> >>>> Rob >>>> >>>> >>>> On 25-Mar-09, at 4:52 PM, Psi Prime, Matthew A Perosi wrote: >>>> >>>> >>>>> I'm using this code right now. >>>>> I have not tested it on every phone imaginable, but it seems to >>>>> work for most smart phones I've tested.... Although it's not >>>>> tested >>>>> on the iPhone. >>>>> >>>>> [text]accept=[GETMIMEHEADER name=Accept][/text] >>>>> [text]celldetected=[/text] >>>>> [showif [url][accept][/url]=[url]text/vnd.wap.wml[/url]] >>>>> [text]wapagent=T[/text] >>>>> [/showif] >>>>> [showif [wapagent]=T] >>>>> [text]celldetected=T[/text] >>>>> [/showif] >>>>> [showif [celldetected]=T] >>>>> [redirect url=/mobi/index.tpl] >>>>> [/showif] >>>>> >>>>> Matthew A Perosi JewelerWebsites.com >>>>> ------------------------------by Psi Prime------- >>>>> Senior Web Developer 323 Union Blvd. >>>>> Totowa, NJ 07512 >>>>> Pre-Sales: 888.872.0274 >>>>> Service: 973.413.8213 >>>>> Training: 973.413.8214 >>>>> Fax: 973.413.8217 >>>>> >>>>> http://www.jewelerwebsites.com >>>>> http://en.wikipedia.org/wiki/Psi_Prime%2C_Inc >>>>> http://www.psiprime.com >>>>> >>>>> >>>>> >>>>> Rob wrote: >>>>> >>>>>> Dan, >>>>>> >>>>>> I just got involved due to a technical request, and haven't had >>>>>> much to do with the site involved. I think its just being handled >>>>>> generically, much like yours. I did notice on the newer >>>>>> blackberry's and iphones, it renders correctly, but on the older >>>>>> styles a lot of positional elements are off. It looks like its >>>>>> just set to a standard width of 320. I know the person working on >>>>>> it is on this list, and its up to him if he wishes to expand on >>>>>> it >>>>>> more. >>>>>> >>>>>> The detection was actually the easy part, and even easier now >>>>>> with >>>>>> the list help. I would imagine you could expand on it and detect >>>>>> size as well, but that would probably take a few hours to dump >>>>>> them all in, and months to find them all. With the shelf live of >>>>>> must phones, I think we'll just stick to the newer versions. Here >>>>>> is a link to the file I used, but for the most part, I went thru >>>>>> some of the server logs for the site involved, as the list didn't >>>>>> seem up to date. I haven't even heard of half these things.... >>>>>> >>>>>> http://homepage.mac.com/rforest/downloads/mobile.zip >>>>>> >>>>>> More info, as well as files, at this link: >>>>>> >>>>>> >> http://studiohyperset.wordpress.com/2007/02/05/mobile-redirect-code-discussi >> >>> on-index/ >>> >>>>>> And what I'm currently using is this: >>>>>> --------------- >>>>>> [If ("[url][browsername][/url]" ^ "iPhone")|("[url][browsername] >>>>>> [/ >>>>>> url]" ^ "Blackberry")|("[url][browsername][/url]" ^ "Samsung")| >>>>>> ("[url][browsername][/url]" ^ "Motorola")|("[url][browsername][/ >>>>>> url]" ^ "HTC")|("[url][browsername][/url]" ^ "Casio")|("[url] >>>>>> [browsername][/url]" ^ "Orange")|("[url][browsername][/url]" ^ >>>>>> "T- >>>>>> Mobile")|("[url][browsername][/url]" ^ "Pocket PC")|("[url] >>>>>> [browsername][/url]" ^ "Opera Mini")|("[url][browsername][/ >>>>>> url]" ^ >>>>>> "Sharp")|("[url][browsername][/url]" ^ "Cingular")|("[url] >>>>>> [browsername][/url]" ^ "SonyEricsson")|("[url][browsername][/ >>>>>> url]" >>>>>> ^ "Palm")|("[url][browsername][/url]" ^ "Windows CE")|("[url] >>>>>> [browsername][/url]" ^ "Mobile Content Viewer")|("[url] >>>>>> [browsername][/url]" ^ "Google CHTML Proxy")|("[url] >>>>>> [browsername][/ >>>>>> url]" ^ "Palmsource")|("[url][browsername][/url]" ^ "Nokia")| >>>>>> ("[url][browsername][/url]" ^ "Smartphone")|("[url][browsername] >>>>>> [/ >>>>>> url]" ^ "Opera 3.62")|("[url][browsername][/url]" ^ >>>>>> "Reqwirelessweb")] >>>>>> [Then][REDIRECT url=mobile/index.html][/Then] >>>>>> [Else] Alternate redirect here, or leave blank if its self [/ >>>>>> Else] >>>>>> [/if] >>>>>> ------------------- >>>>>> >>>>>> Sure would be nice to see some type of standardization for this >>>>>> area in that industry. ... :-( >>>>>> >>>>>> Rob >>>>>> >>>>>> >>>>>> On 25-Mar-09, at 3:49 PM, Dan Strong wrote: >>>>>> >>>>>> >>>>>>> Rob, >>>>>>> >>>>>>> I'm curious how you (or anyone for that matter) is/are handling >>>>>>> detection of other mobile devices. I have tried (and not yet >>>>>>> resolved) a way to catch all (or as many) mobile devices as I >>>>>>> can >>>>>>> so I can serve mobile-friendly content. >>>>>>> >>>>>>> 1) I've thought about using the WRFL data source ( >>>>>>> >>> http://wurfl.sourceforge.net/ >>> >>>>>>> ) but it contains a lot of irrelevant (for my purposes) data and >>>>>>> would require what appears to be a great deal of work and >>>>>>> constant upkeep, and/or >>>>>>> >>>>>>> 2) http://detectmobilebrowsers.mobi/ - php script. Haven't tried >>>>>>> it. Not against using php when I need to, but I try to do things >>>>>>> via WebDNA. >>>>>>> >>>>>>> 2) Detecting screen-size via javascript (if screen size is >>>>>>> under, >>>>>>> say, 400px wide then serve mobile.css) ... but that won't always >>>>>>> work since not all mobile devices speak javascript... >>>>>>> >>>>>>> For now I'm doing like you are and detecting the most popular >>>>>>> devices, but I'd really love to be able to catch them all. It >>>>>>> would be nice if all mobile devices would add a standard >>>>>>> descriptor to their USER AGENT header, like --mobile-- or >>>>>>> somethinglike that. Anyhow, like I said, just curious. >>>>>>> >>>>>>> ** Cue the programmer with the "duh, you do it like this with a >>>>>>> single line of code" response ** >>>>>>> -Dan >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Wed, 25 Mar 2009 14:55:29 -0600 >>>>>>> Rob wrote: >>>>>>> >>>>>>>> Yup.... Got it... Thanks.. >>>>>>>> Works perfect! ... Thanks for all the help... >>>>>>>> Rob >>>>>>>> On 25-Mar-09, at 2:16 PM, Donovan Brooke wrote: >>>>>>>> >>>>>>>>> Rob wrote: >>>>>>>>> >>>>>>>>>> Darn.... I gotta remember to use the online docs instead of >>>>>>>>>> my own... got to used to working alone before the >>>>>>>>>> revival .. ;-) >>>>>>>>>> Thanks Paul... >>>>>>>>>> >>>>>>>>> You will want to encode browsername most likely.. >>>>>>>>> >>>>>>>>> [if "[url][browsername][/url]"... >>>>>>>>> >>>>>>>>> >>>>>>>>> Donovan >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Donovan D. Brooke PH: 1 (608) 770-3822 >>>>>>>>> ------------------------------------------------ >>>>>>>>> VP >>>>>>>>> WebDNA Software Corporation >>>>>>>>> 16192 Coastal Highway >>>>>>>>> Lewes, DE 19958 >>>>>>>>> --------------------------------------------------------- --Apple-Mail-3-680614936 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
This is a nice collection = of mobile browser identifiers. Thanks for = sharing.

This provides a good opportunity for = me to soapbox a little bit regarding code optimization and the use of = URL and comment contexts.

I'm not sure how you're = using this, but it looks like it might be something that gets executed = very often. It is important to note the performance hit that comes up = for every WebDNA tag that gets called.  Every [url] context, every = [!] context, etc. takes up a little bit of processor time. With a = lengthy list of contexts as you have listed here, if this is in = something like a header file that gets called on every page, removing = extra contexts can result in a noticeable performance = improvement.

To optimize this code, I would start by = only URL'ing the browsername once, storing the URL'ed version in a text = variable and using that in the if = statement.

Next, I would remove all of the = comment tags. I just ran a test to verify this, and you can have line = breaks and spaces between the parenthetical logical expressions and the = IF context still works properly.

Finally, I = would only URL the items on the right side of the expressions if = necessary. In the list you show, this would only be those items that = contain spaces, since those would be converted to %20 by the URL and you = need that done on both sides of the expression. Dashes, periods, = forward-slashes, letters and digits are not affected by URL, so you can = skip the URL context on those.

The optimized = version would look like = this:

[text]uBrowser=3D[url][browsername][/url][/= text]
[if ("[uBrowser]"^"iPhone") = |
  ("[uBrowser]"^"Blackberry") |
  ("[uBrowser]" ^ = "Samsung") |
  ("[uBrowser]" ^ = "Motorola") |
  ("[uBrowser]" ^ = "HTC") |
  ("[uBrowser]" ^ = "Casio") |
  ("[uBrowser]" ^ = "Orange") |
  ("[uBrowser]" ^ = "T-Mobile") |
  ("[uBrowser]" ^ "[url]Pocket = PC[/url]") |
  ("[uBrowser]" ^ "[url]Opera = Mini[/url]") |
  ("[uBrowser]" ^ = "Sharp") |
  ("[uBrowser]" ^ = "Cingular") |
  ("[uBrowser]" ^ = "SonyEricsson") |
  ("[uBrowser]" ^ = "Palm") |
  ("[uBrowser]" ^ "[url]Windows = CE[/url]") |
  ("[uBrowser]" ^ "[url]Mobile Content = Viewer[/url]") |
  ("[uBrowser]" ^ "[url]Google CHTML = Proxy[/url]") |
  ("[uBrowser]" ^ = "Palmsource") |
  ("[uBrowser]" ^ = "Nokia") |
  ("[uBrowser]" ^ = "Smartphone") |
  ("[uBrowser]" ^ "[url]Opera = 3.62[/url]") |
  ("[uBrowser]" ^ = "lg-") |
  ("[uBrowser]" ^ = "sie-") |
  ("[uBrowser]" ^ = "up.b") |
  ("[uBrowser]" ^ = "up/")|
  ("[uBrowser]" ^ = "Reqwirelessweb")
]
[then][text]celldetected=3DT[/text][/then]
[else]= [text]celldetected=3D[/text][/else]
[/if]
[showif = [celldetected]=3DT]redirect or do something here[/showif]


For = comparison, I put the original code inside a [loop start=3D1&end=3D100= ] context and dumped the elapsed time afterwords, and it took 17 ticks. = I tried it again with my optimized version and it took 8 ticks to = execute 100 times. That's better than a 50% improvement.

On a low traffic or rarely accessed page, this wouldn't = make a lot of difference, but on a high traffic page the difference is = very apparent.

Brian = Fries
BrainScan Software


Brian = Fries
BrainScan Software


On May = 23, 2009, at 4:50 PM, Psi Prime, Matthew A Perosi wrote:

I'm following up on this 2 month = old thread for the benefit of the community, with new information after = some extensive testing on my .mobi website.

The code the Rod = provided below works very well, but it is missing 4 browser types.
= The missing types are lg-, sie-, up.b and up/
Also I found the IF = statement to be flaky without the full use of the [url] context of the = right side of each ^

Here is my rewritten, tested code that = works as of today, May 23, 2009. 
The [!][/!] have only been = added for ease of reading on email and archives.
= -------------------------------
[if ("[url][browsername][/url]" ^ = "[url]iPhone[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Blackberry[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Samsung[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Motorola[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]HTC[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Casio[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Orange[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]T-Mobile[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Pocket PC[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Opera Mini[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Sharp[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Cingular[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]SonyEricsson[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Palm[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Windows CE[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Mobile Content Viewer[/url]")|[!]
= [/!]("[url][browsername][/url]" ^ "[url]Google CHTML = Proxy[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Palmsource[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Nokia[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Smartphone[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Opera 3.62[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]lg-[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]sie-[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]up.b[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]up/[/url]")|[!]
[/!]("[url][browsername][/url]" ^ = "[url]Reqwirelessweb[/url]")]
= [then][text]celldetected=3DT[/text][/then]
= [else][text]celldetected=3D[/text][/else]
[/if]
[showif = [celldetected]=3DT]redirect or do something here[/showif]
= --------------------------------------------


Matthew A Perosi            =JewelerWebsites.com------------------------------by Psi Prime-------Senior Web Developer             323 Union Blvd.                                 Totowa, NJ 07512Pre-Sales: 888.872.0274Service:   973.413.8213Training:  973.413.8214Fax:       973.413.8217http://www.jewelerwebsites.com=http://en.wikipedia=.org/wiki/Psi_Prime%2C_Inchttp://www.psiprime.com

=
Michael A. DeLorenzo wrote:
OK...Now it comes up with the mobile page and properly detects =my AndroidOS.-----Original Message-----From: Rob [mailto:rforest@mac.com]=20Sent: Thursday, March 26, 2009 10:31 AMTo: talk@webdna.usSubject: Re: [WebDNA] I'm stuck... :-(Mike,This is because the first one defaulted to the home page, I didn't =20have Android in there yet.. :-(.Fixed ... added to both...The phone section doesn't contain any flash.RobOn 26-Mar-09, at 7:33 AM, Michael A. DeLorenzo wrote:  
First worked but =my phone did not load the flash.Second did not work at all.T-Mobile G1 with AndroidMike-----Original Message-----From: Rob [mailto:rforest@mac.com]Sent: Wednesday, March 25, 2009 7:20 PMTo: talk@webdna.usSubject: Re: [WebDNA] I'm stuck... :-(Here is a test of both methods if anyone wants to confirm:Using REFERRERhttp://kalvanna.com/mobile2.dnaUsing GETMIMEHEADERhttp://kalvanna.com/mobile3.dnaNot sure why the second one didn't work with the iphone... :-( ..would have been a heck of a lot easier...RobOn 25-Mar-09, at 5:03 PM, Rob wrote:    
Just tried =this on the Iphone... doesn't seem to detect it... :-(RobOn 25-Mar-09, at 4:52 PM, Psi Prime, Matthew A Perosi wrote:      
I'm =using this code right now.I have not tested it on every phone imaginable, but it seems towork for most smart phones I've tested.... Although it's not testedon the iPhone.[text]accept=3D[GETMIMEHEADER name=3DAccept][/text][text]celldetected=3D[/text][showif [url][accept][/url]=3D[url]text/vnd.wap.wml[/url]][text]wapagent=3DT[/text][/showif][showif [wapagent]=3DT][text]celldetected=3DT[/text][/showif][showif [celldetected]=3DT][redirect url=3D/mobi/index.tpl][/showif]Matthew A Perosi            JewelerWebsites.com------------------------------by Psi Prime-------Senior Web Developer             323 Union Blvd.                             Totowa, NJ 07512Pre-Sales: 888.872.0274Service:   973.413.8213Training:  973.413.8214Fax:       973.413.8217http://www.jewelerwebsites.com=http://en.wikipedia=.org/wiki/Psi_Prime%2C_Inchttp://www.psiprime.comRob wrote:        
Dan,I just got involved due to a technical request, and haven't hadmuch to do with the site involved. I think its just being handledgenerically, much like yours. I did notice on the newerblackberry's and iphones, it renders correctly, but on the olderstyles a lot of positional elements are off. It looks like itsjust set to a standard width of 320. I know the person working onit is on this list, and its up to him if he wishes to expand on itmore.The detection was actually the easy part, and even easier now withthe list help. I would imagine you could expand on it and detectsize as well, but that would probably take a few hours to dumpthem all in, and months to find them all. With the shelf live ofmust phones, I think we'll just stick to the newer versions. Hereis a link to the file I used, but for the most part, I went thrusome of the server logs for the site involved, as the list didn'tseem up to date. I haven't even heard of half these things....http://homep=age.mac.com/rforest/downloads/mobile.zipMore info, as well as files, at this link:          
=
http://studiohyperset.wordpress.com/2007/02/05/mobile-redirect=-code-discussi  
on-index/    
=
And what I'm =currently using is this:---------------[If ("[url][browsername][/url]" ^ "iPhone")|("[url][browsername][/url]" ^ "Blackberry")|("[url][browsername][/url]" ^ "Samsung")|("[url][browsername][/url]" ^ "Motorola")|("[url][browsername][/url]" ^ "HTC")|("[url][browsername][/url]" ^ "Casio")|("[url][browsername][/url]" ^ "Orange")|("[url][browsername][/url]" ^ "T-Mobile")|("[url][browsername][/url]" ^ "Pocket PC")|("[url][browsername][/url]" ^ "Opera Mini")|("[url][browsername][/url]" ^"Sharp")|("[url][browsername][/url]" ^ "Cingular")|("[url][browsername][/url]" ^ "SonyEricsson")|("[url][browsername][/url]"^ "Palm")|("[url][browsername][/url]" ^ "Windows CE")|("[url][browsername][/url]" ^ "Mobile Content Viewer")|("[url][browsername][/url]" ^ "Google CHTML Proxy")|("[url][browsername][/url]" ^ "Palmsource")|("[url][browsername][/url]" ^ "Nokia")|("[url][browsername][/url]" ^ "Smartphone")|("[url][browsername][/url]" ^ "Opera 3.62")|("[url][browsername][/url]" ^"Reqwirelessweb")][Then][REDIRECT url=3Dmobile/index.html][/Then][Else] Alternate redirect here, or leave blank if its self [/Else][/if]-------------------Sure would be nice to see some type of standardization for thisarea in that industry. ... :-(RobOn 25-Mar-09, at 3:49 PM, Dan Strong wrote:          
Rob,I'm curious how you (or anyone for that matter) is/are handlingdetection of other mobile devices. I have tried (and not yetresolved) a way to catch all (or as many) mobile devices as I canso I can serve mobile-friendly content.1) I've thought about using the WRFL data source (            
=
http://wurfl.sourceforge.net/    
=
=
) but it contains a lot of irrelevant (for my =purposes) data andwould require what appears to be a great deal of work andconstant upkeep, and/or2) http://detectmobilebrowsers.mob=i/ - php script. Haven't triedit. Not against using php when I need to, but I try to do thingsvia WebDNA.2) Detecting screen-size via javascript (if screen size is under,say, 400px wide then serve mobile.css) ... but that won't alwayswork since not all mobile devices speak javascript...For now I'm doing like you are and detecting the most populardevices, but I'd really love to be able to catch them all. Itwould be nice if all mobile devices would add a standarddescriptor to their USER AGENT header, like --mobile-- orsomethinglike that. Anyhow, like I said, just curious.** Cue the programmer with the "duh, you do it like this with asingle line of code" response **-DanOn Wed, 25 Mar 2009 14:55:29 -0600Rob <rforest@mac.com> wrote:            
=
Yup.... Got it... Thanks..Works perfect! ... Thanks for all the help...RobOn 25-Mar-09, at 2:16 PM, Donovan Brooke wrote:              
=
Rob wrote:                
=
Darn.... I gotta remember to use the online docs =instead ofmy  own... got to used to working alone before therevival .. ;-)Thanks Paul...                  
=
You will want to encode browsername most likely..[if "[url][browsername][/url]"...Donovan--=20Donovan D. Brooke       PH: 1 (608) 770-3822------------------------------------------------VPWebDNA Software Corporation16192 Coastal HighwayLewes, DE 19958---------------------------------------------------------=

= --Apple-Mail-3-680614936-- Brian Fries

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

WebCat2b12plugin - [search] is broken ... not! (1997) [WebDNA] Fails to recognize comma-separated db (2010) [WebDNA] WebDNA and PHP cohabitating? (2009) Can WC remember people? (1998) RE: [WebDNA] Forum Module Made In WebDNA (2020) forming a SKU (1999) [Fwd: Rotating Banners ... (was LinkExchange)] (1997) webcat 2.1 (1997) sort problems....bug or brain fart? (1997) search comparison (2003) embedded search vs. URL (2004) Format question WC Mac f3 (1997) Speed Admin? (Was FlushDatabases) (1997) Re:E-Mailer (WebCatb15acgiMac) (1997) How do I get multiple unique numbers on one template? (2000) Re:quit command on NT (1997) No luck with taxes (1997) Configuring E-mail (1997) Commas in search (1998) Problems appending to database (1997)