Add Touchpad to the Browser Object #2153

wants to merge 3 commits into


None yet
5 participants

dehenne commented Dec 3, 2011

Add Touchpad to the Browser Object: Browser.version = 1; = 'touchpad' ... a little Fix


ibolmo commented Dec 19, 2011

Thanks, could you provide us with a copy of the UA string? I'd like to study it before merging in this PR.

dehenne commented Dec 20, 2011

The complete UA String is:

Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.4; U; de-DE) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.76 Safari/534.6 TouchPad/1.0

I hope this helps :-)


arian commented Jan 8, 2012

We have Browser.Platform.webos already right?
Though it looks like that won't be true with this UA string.. (we test for webos and this UA string contains wOS)..


ibolmo commented Feb 5, 2012

@arian could be as a result of hp acquiring webOS?


arian commented Feb 5, 2012

I'm not familiar with webOS, and how much it changed with the acquisition, but I'd like to keep it webos, rather than adding touchpad, because that's very device specific.

dehenne commented Feb 10, 2012

Sorry for the long response, I think webos is better, too,
Hmm, I have another idea, what you think about:

Platform: {
    name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:hpwos)/) ? 'webos' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0])

And in the UA match line we add 'hpwos' for the Version:

UA = ua.match(/(opera|ie|firefox|chrome|hpwos|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],

Henning Leutz added some commits Feb 10, 2012

Henning Leutz Revert "Add Touchpad to the Browser Object: Browser.version = 1; Brow…
… = 'touchpad'"

This reverts commit e63380f.
Henning Leutz Browser support for new chrome android version and HPTouchpad; Fix fo…
…r the version number (no parseFloat) because some Browsersversions are x.x.x.x

dehenne commented Feb 10, 2012

Hey Guys,

sorry for double post. Maybe i have an easier way for it.
We can do:

navigator.userAgent.toLowerCase().replace('hpwos', 'webos').replace('crmo', 'chrome')

And i think i have a bug in the version parameter. I implement the new chrome android version and saw

version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),

The versions of chrome (android) and touchpad browser like

parseFloat() convert x.x.x to x

If you want I can make a new pull request with all fixes and we can close this request.

The fix include the new chrome android. On my nexus the UA string is:

mozilla/5.0 (linux; u; android 4.0.3; de-de; nexus s build/iml74k) applewebkit/535.7 (khtml, like gecko) crmo/16.0.912.75 mobile safari/535.7

Whats your opinion, is the replace a bad idea?


fakedarren commented Jul 28, 2012

Adding this to Core would be a bad idea. If, in your specific use case, you need to detect a specific device like this, you can easily add it in your own code.

fakedarren closed this Jul 28, 2012


satazor commented Aug 11, 2012

@fakedarren don't you seem legit to fix the hpwOS to be parsed in the core?
I expect that Browser.webos would be true if someone is running a HP Touchpad that runs the new webOS 3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment