Git Product home page Git Product logo

bowser's People

Contributors

alexandercerutti avatar anthem001 avatar bendingbender avatar bpierre avatar cordazar avatar dasred avatar ded avatar dependabot[bot] avatar evenchange4 avatar greenkeeper[bot] avatar janka102 avatar jballin avatar jmtavares avatar kerbyfc avatar lancedikson avatar michaeljcole avatar monkeywithacupcake avatar naorpeled avatar oliverfoster avatar pastak avatar plukevdh avatar pokono avatar rcohen-unext avatar rcsandell avatar rkurbatov avatar robcrawford avatar rwwl avatar smtlaissezfaire avatar willamesoares avatar xiphe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bowser's Issues

detect IOS Safari, Opera Mini, Android Browser and Chrome for Android, please help?

Hi, for some reasons I'm interested in detecting following browsers,
which are the one used by caniuse.com:

  • ie
  • firefox
  • chrome
  • safari
  • opera
  • ios safari
  • opera mini
  • android browser
  • chrome for android

I figured out how to check for the easy ones, but could you help me
to complete the list?
Or maybe it's not possible?

  • ie => bowser.msie
  • firefox => bowser.firefox
  • chrome => bowser.chrome
  • safari => bowser.safari
  • opera => bowser.opera

(and below, I'm not sure at all)

  • ios safari => bowser.safari && bowser.ios
  • opera mini => bowser.opera && bowser.mobile
  • android browser => bowser.android
  • chrome for android => bowser.android && bowser.chrome

Amazon Silk identified as Chrome

The Amazon Slik Browser has a "like chrome" in the user agent string, so

else if (/silk/i.test(ua)) {

must be before

else if (/chrome|crios|crmo/i.test(ua)) {

Fix bower warnings

Running bower install --save bowser yields:

bower bowser#*              not-cached git://github.com/ded/bowser.git#*
bower bowser#*                 resolve git://github.com/ded/bowser.git#*
bower bowser#*                download https://github.com/ded/bowser/archive/v0.7.2.tar.gz
bower bowser#*                 extract archive.tar.gz
bower bowser#*              deprecated Package bowser is using the deprecated component.json
bower bowser#*                mismatch Version declared in the json (0.7.1) is different than the resolved one (0.7.2)
bower bowser#*            invalid-meta bowser is missing "ignore" entry in bower.json
bower bowser#*                resolved git://github.com/ded/bowser.git#0.7.2
bower bowser#~0.7.2            install bowser#0.7.2

bowser#0.7.2 vendor\bowser

Support for Puffin browser

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");
      }
    }

Missing Semi-colon

When I minify all my JS, including the bowser library will cause an error — seems like the latest build is missing a semi-colon at the very end.

Support detection of Microsoft Spartan

http://en.wikipedia.org/wiki/Spartan_%28browser%29

'Spartan" is the codename of a web browser under development by Microsoft. Officially unveiled on January 21, 2015, and first publicly released as a preview on March 30, 2015, it will replace Internet Explorer as the default browser of Windows 10 PCs, smartphones and tablets.'

Is support for detection of Spartan planned?
Or can this be achieved using the existing code?

Thanks in advance.

How can I detect a custom user agent string from GhostInspector?

I'm using the wonderful Ghost Inspector (https://ghostinspector.com/) to run automated tests on my app and need to ensure that the requests from them bypass my browser minimum requirements check, in Ghost Inspector you can set a custom user agent string but how would I set about bypassing the browser check if that's present... currently I have:

if ((bowser.msie && bowser.version < 8) || (!bowser.ios && !training.hasFlash())) {
    if (typeof unsupported_redirect_path!="undefined") {
        window.location = unsupported_redirect_path;
    }
}

IE11 on Windows 8.1 can cause `tablet` to be true

Checking for mobile and tablet can potentially cause false positives on certain Windows 8 devices (in our case a Asus X551M but users reported issues from MS Surface's as well).

We did not catch this using the MS provided VM's.

I realize that this is not technically a bug in bowser but I wanted to put this out there in case anybody else runs into the same issue.

To get around this we are now doing the following:

if ((bowser.tablet || bowser.mobile) && !bowser.msie) { etc }

module.exports['browser'] <-- typo?

!function (name, definition) {
  if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
  else if (typeof define == 'function' && define.amd) define(definition)
  else this[name] = definition()
}('bowser', function () {

May be it should be module.exports['bowser']?

Define license of the library

For some commercial projects it is important to know licenses of all libraries that are included into distribution. What is the license of this product?

Ubuntu Touch detection

I am missing a correct detection of the Ubuntu Touch smartphone device.

"Mozilla/5.0 (Linux; Ubuntu 14.04 like Android 4.4) AppleWebKit/537.36 Chromium/35.0.1870.2 Mobile Safari/537.36"

Problem width Graded Browser Support

I tryed the Graded Browser Support in chrome 11.0.696.68 osx and it returns to me bowser.x not bowser.a probably is failing the (bowser.chrome && bowser.version >= 8) probably because the string nature of bowser.versione probably it should be split until the . and taken just the major version number.

Thanks bye

JavaScript error due to missing semicolon

Please add semicolon at the end of minified file because missing semicolon caused javascript error at following place:

!function(e,t){ /* bowser minified code*/}) 

/*!
 * jQuery Migrate - v1.2.1 - 2013-05-08
 * https://github.com/jquery/jquery-migrate
 * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors; Licensed MIT
 */
(function( jQuery, window, undefined ) {...})( jQuery, window );

Expose OS Detection api

It would be really cool if the Operating System detection was part of the public api. I'm using bowser to log information for bug reports and ideally I'd know: OS, OS version, Browser, Browser Version.

npm package not up to date

Is there any plan to update the npm package to include the os detection changes that were merged a couple days ago?

Support for Firefox Android

Hi,

on android using firefox, bowser returns same as on android default browser.
The UA is Mozilla/5.0 (Android; Tablet; rv:27.0) Gecko/27.0 Firefox 27.0

Thank you

Error on line 144 in browser.js

Hi, I don't know if I missing something, or this is a bug, but when I included the browser.js, I got error in Chrome console :Uncaught SyntaxError: Invalid regular expression: missing /
So, I just commented this line, and now it's works, but I don't know it there is some bug or I did something wrong...

IE Compatibility Mode

When you are using IE 10 in Compatibility mode, userAgent string contains 'MSIE 7.0' and 'Trident/6.0'
Bowser is detecting it as IE 7.
Not sure if this is an intended feature as it's displayed in compatibility, but the actual IE version is IE10

Return Browser as Variable

Right now you have functions like if browsers = chrome then.
It would be nice to just write the browser to a variable for use later. This is extremely useful if you add a class to body with the browser name (sorta like modernizr).

some like this
var browser = detect.browser

Doesn't work for Moto X

Moto X on Chrome reports the following UserAgent:

Mozilla/5.0 (Linux; Android 4.4.4; XT1032 Build/KXB21.14-L1.40) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.102 Mobile Safari/537.36

Hello, China?

Does that sound a little racist or it's just an emphasizing of the distressful fact?

Issue with IE11

Hi

I had some issues with bowser in our javascript widget in IE11. IE debugger delivers following error:

if (version) { version = version[0].split('/')[1]; } else { version = /Opera\/[\.\d]+/.exec(ua)[0].split('/')[1]; }

Unable to get property '0' of undefined or null reference.

If I force IE11 to use IE10 Engine via meta tag (<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10"/>) the errors doesn't accour.

Maybe someone else has a similar problem with bowser.

Support of new Safari on IOS 8 User agent

Latest Safari on IOS 8 is not supported currently with bower

Here is the new user agent to add:
Mozilla/5.0 (ipad; CPU OS 8_0 like Mac OS X) AppleWebKit/600.1.4
(KHTML, like Gecko) Version/8.0 Mobile/12A365 Safari/600.1.4

Thanks in advance,

Get Browser Name

It would be usefull to get browser name from the bowser structure.

I would for example like to use this lib for detecting browser name for my logs.

So what about adding 'browserName' parameter to the result structure like this?:

if (ie) return {
    msie: t
  , version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
  , browserName: 'IE'
  }
if (opera) return {
    opera: t
  , version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)[1]
  , browserName: 'Opera'
  }

Consider more strict jshint settings

Hey @ded

We talked about this, a long time ago and i totally respect that your project is written in the code style you like and love.
Unfortunately i'm not able to switch back to your main branch since our build tool is more strict about the javascript syntax it can handle, and breaks when trying to minify bowser.

If you're ok with it, i will try to tighten up your jshint config until i pass our pipeline and then open a PR. However if that's not an option for you i'll just stick to our fork.

kind regards, Hannes.

bower install

Can you please provide a tag and register it for bower install?

Exception with QupZilla

useragent: "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) QupZilla/1.8.6 Safari/537.21"

results in the following error:

TypeError: 'null' is not an object (evaluating 'e.match(v)[1]')

I realize not every obscure browser can be supported, but perhaps return "unknown" instead of throwing an exception?

browser level check unreliable? sleipnir, k-meleon, greenbrowser, slimbrowser, deepnet

sleipnir
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36 Sleipnir/6.1.4

bowser.chrome     // true
bowser.version    // 39
bowser.a          // true

k-meleon
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20140105 Firefox/24.0 K-Meleon/74.0

bowser.firefox    // true
bowser.version    // 24
bowser.a          // true

greenbrowser
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2; GreenBrowser)

bowser.msie       // true
bowser.version    // 7
bowser.c          // true

deepnet
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; InfoPath.2)

bowser.msie       // true
bowser.version    // 7
bowser.c          // true

slimbrowser
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

bowser.msie       // true
bowser.version    // 11
bowser.a          // true

Is bowser working as designed?

Basically we don't see how the browser level checks such as bowser.msie and boswer.firefox can be trusted at all.

Detect Microsoft Edge

Since Windows 10 will be released in one month, it would be nice if detection of Microsoft's newest browser could be included before then. Here is an example UA string from MSDN:

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0

Unable to Detect iOS 8 or 9

I have a PhoneGap application that displays a “platform not supported” banner on the login page when Bowser detects a browser that does not fit my criteria of supported platform and supported version.
My base logic is set up like this:

var isSupported = Bowser[platform] && Bowser.version >= minSupportedVersion;

where:
Bowser[‘ios’] && Bowser.version >= '8'

But when I use an iPad with any of these user agents:
Mozilla/5.0 (iPad; CPU OS 9_0_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13A452
Mozilla/5.0 (iPad; CPU OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H143
Mozilla/5.0 (iPad; CPU OS 8_4_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12H321

isSupported is set to false, and the user is erroneously shown that they are using an unsupported browser. This behavior does not present itself when I’m detecting traditional desktop browsers like Chrome or Internet Explorer (the library correctly detects these platforms).

Is something in my logic incorrect, or is the library not reporting something correctly?

Should detect be considered public API?

It looks like _detect is exposed for testing bowser, and obviously it's indicated as private via the underscore. I imagine bowser could be useful for use in node where you could give it UA strings to parse, rather than having it grab the document's, in the case of the browser.

Of course if you feel that bowser is a browser-exclusive module I understand. There are, after all, other modules that detect more than bowser does, but I appreciate its leanness.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.