Page: 1, 2  Next

Browser detection Scripts - Add Support for UC Browser
jeffshead
Status: Curious
Joined: 21 Apr 2013
Posts: 9
Reply Quote
Would the developers consider adding support for the UC Browser or tell me how I can add it myself?

Below is an example of the UA string from a Windows Phone:
:: Code ::
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; XBLWP7; ZuneWP7) UCBrowser/2.9.0.263

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
given this appears to be a msie based browser, to add support would require adding a similar method as webkit/gecko use, to return types of a certain rendering engine browser array.

I'll take a look at it, it wouldn't kill anything to have such an msie type array as well to go with webkit and gecko and soon blink and one other one that is coming down the pike.

I can't break actual msie support however, in other words, the default would have to show that this is in fact msie 9 or whatever version it is, the optional info would just be some extra data you could get if you selected that option in the browser detector.
Back to top
jeffshead
Status: Curious
Joined: 21 Apr 2013
Posts: 9
Reply Quote
Sounds great! Thanks for sharing :)

Here's the UA string from an Android as well:
:: Code ::
Mozilla/5.0 (Linux; U; Android 2.3.3; en-us ; LS670 Build/GRI40) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1/UCBrowser/8.6.1.262/145/355

Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
ah, that's not something I would have expected, so they make a browser using two different rendering engines, interesting.

It's easy to add to the webkit type array, and I see no issue with creating a corresponding trident type array as exists for webkit and moz already, the logic is no different.

I'll try to get to this this week if I have time, but I see no issues implementing the feature.

If you have more useragents, just post them, the more the better, older ones, whatever, so I can see if the patterns are consistent.

UCBrowser/8.6.1.262/145/355

that part is messy, I believe the default logic is to just return the part before the second slash there, otherwise the data is too hard to actually parse, so that's what will happen.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I've now set browser detection to use ucbrowser and ucweb ids for mobile devices, and added two types as well, the webkit and the trident engine.

trident engine requires a new return value, which is listed in the top script headers.

in mobile device output, uc browsers should show without any changes, including their version numbers.

This is now live in browser detection 5.5
Back to top
jeffshead
Status: Curious
Joined: 21 Apr 2013
Posts: 9
Reply Quote
WOW! That was fast. I'll download it and give it a test.
Back to top
jeffshead
Status: Curious
Joined: 21 Apr 2013
Posts: 9
Reply Quote
I tested the new PHP Browser Detection script on both my test site and on TechPatterns.com and get different results.

The UC Browser is detected on TechPatterns.com but not when I access the "Your Computer" script page on my test site.

How does the "Your Computer" script being used on TechPatterns.com vary from the downloadable version?
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
I haven't added the first msie / trident type output to the your computer script yet, didn't feel like it yesterday.

I don't know how the stuff varies to be honest, i'd have to go over it line by line to see that, usually it's fairly close, it's not exactly the same because there's some things that I never trusted users to do right, like header checks for xhtml support.

The your computer info script component takes a bit more work to keep updated than the other scripts because it's not a drop in chunk like the other libraries, plus I like to have a few extra features in the live one just to do it.

However, if you dont' see mobile browser type ucbrowser or whatever, then you have probably done something wrong somewhere, I believe that is standard output.
Back to top
jeffshead
Status: Curious
Joined: 21 Apr 2013
Posts: 9
Reply Quote
All I did was upload the new PHP browser detect script and the "Your Computer" sample script. Nothing to mess up.

I noticed if you change the UC Browser setting (Advanced->Website type) from Desktop to Mobile, the "Your Computer" script on TechPatterns.com will still detect the browser but the downloadable "Your Computer" script does not.
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
the downloadable your computer script is just offered as a service to get people started, it's not promised or guaranteed to be the same as the live one, since there are too many ways for someone to mess up things.

However, in the handheld device section, from my initial scan of the code, there should be no difference, but I don't have the time to do a line by line code check of the two versions..

If you're presenting it with a different user agent, which you may be doing, I'd have to see the two users agents, from handheld/desktop types to see if there are any particular differences, but in general, it's the end user's responsibility to take the php browser detection library and use it however they want, the your computer thing is just there because some people asked for the basic code.

Also note, the your computer info script does NOT currently have support for the trident sub type output in it, I'll do that at some point but not in the near future, have other stuff to do.

Why not try to find the difference in the downloaded code that creates different output, there's not a whole lot of code there to work on so it should't be that hard. I don't personally use that downloaded thing for anything, I just try to roughly synch the two versions now and then, but I never actually test the downloaded your computer box version myself.
Back to top
Display posts from previous:   
Page: 1, 2  Next
All times are GMT - 8 Hours