Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Puffin browser #68

Closed
rossisen opened this issue Dec 1, 2014 · 3 comments
Closed

Support for Puffin browser #68

rossisen opened this issue Dec 1, 2014 · 3 comments
Milestone

Comments

@rossisen
Copy link

rossisen commented Dec 1, 2014

Puffin is a popular browser for mobile. I have hacked part of the code to read its user agent string. Puffin FAQ (https://www.puffinbrowser.com/faq/ gives format of user agent at bottom of the page).

Not sure about whether the order makes sense or whether there are broader concerns to worry about.

if (/puffin/i.test(ua)) {
        var puffinMatch = getFirstMatch(/(?:puffin)[\/](\d+(\.\d+)?(\.\d+)?..)/i);
        var puffinLength = puffinMatch.length;
        result = {
        name: 'Puffin'
      , puffin: t
      , version: puffinMatch.substring(0, puffinLength - 2)
      , puffinDevice: puffinMatch.substring(puffinLength - 2)
      }
      var firstPuffinCharacter = result.puffinDevice.substring(0, 1);
      var secondPuffinCharacter = result.puffinDevice.substring(1);
      if (firstPuffinCharacter == 'A'){
        result.android = t;
        result.mobile = t;
      } else if (firstPuffinCharacter == 'I'){
        result.ios = t;
        result.mobile = t;
      } else {
        alert("Puffin may have changed its user agent string format - submit feedback at top right");
      }
      if (secondPuffinCharacter == 'T'){
        result.tablet = t;
      } else if (secondPuffinCharacter != 'P'){
        alert("Puffin may have changed its user agent string format - submit feedback at top right");
      }
    }
@rossisen
Copy link
Author

rossisen commented Dec 2, 2014

Or rather say:
var puffinMatch = getFirstMatch(/(?:puffin)//i);
Since the android version number has four groupings.

@ded
Copy link
Collaborator

ded commented Dec 3, 2014

i've used puffin!!! yeah. we can def get this in here.

@GhaziTriki
Copy link

Hello,

I am also interested in puffin integration. Do you need a pull request or can you add the update above?

@lancedikson lancedikson added this to the 1.2.0 milestone May 9, 2016
lancedikson added a commit that referenced this issue May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants