Giter VIP home page Giter VIP logo

detect-mobile-browser's People

Contributors

avindra avatar maurociancio avatar nivit avatar smali-kazmi avatar userlond avatar vondro avatar wtower 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

Watchers

 avatar  avatar  avatar

detect-mobile-browser's Issues

"SmartPhone" -> "Mobile"

I think you should have chosen "Mobile" as tablets are not phones, other than that this is great :).

Also i find it odd that you are using browser-detector as the bower name, and the entry point is named detect-browser and your namespace is SmartPhone.

We should standardize all of this ;).

requiring bug.

Hi @smali-kazmi ,

I tried to require it as var mobileBrowser = require( 'detect-browser');, it was giving me error as Cannot find module 'detect-browser', but when I tried var mobileBrowser = require( path.join(global.config.root, '/node_modules/detect-mobile-browser/detect-browser'));, it worked fine.

UserAgent is null

Hey,

I tested this simply:

<script type="text/javascript" src="js/detect-mobile.js"></script>
<script type="text/javascript">
    console.log(SmartPhone.isAny());
</script>

Result:
Cannot read property "match" of null on line 28 in detect-mobile.js

It seems that the "userAgent"-property within the SmartPhone-object is null.
The reason is, that (tested under webkit & firefox) console.log(typeof window); prints object and not function, and therefore the user Agent will not be set. I don't know why this bug has not been detected before, but the solution is simple:

On line 111, change:

if(typeof window === 'function') {

to:

if(typeof window === 'function' || typeof window === 'object') {

Problem testing frontend

Why is this not working?..sorry if i'm misunderstanding something
<!doctype html>

<title>Untitled Document</title> <script src="detect-browser.js"></script> <script> window.onload = function(){ alert("isAny " + SmartPhone.isAny()); alert("isAndriod " + SmartPhone.isAndroid()); } </script>

False positive for Firefox on Windows

Hello there,

another strange bug seems to appear: SmartPhone.isAny() says true when opening the web page with Firefox on Windows 10 Desktop.

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0
... matches of course the check of return this.getUserAgent().match(/Firefox/i);

I don't know how to detect the mobile Firefox, but a solution could be using a mix of platform and user agent detection like:

return this.getUserAgent().match(/Firefox/i) && navigator.platform.match(/android/i);

This would work for all phones except the FirefoxOS as Firefox is currently only deployed to android. But in cause of my lack of experience with mobile firefox I don't commit this as a pull request and I'm only suggesting it here. Also, this solution would break the Node.JS-support.

Greetings

Very minor spelling error in readme

Thanks for this nice app. There is a very small error in README.md line 16:

alert(SmartPhone.isAndriod());

Should be:

alert(SmartPhone.isAndroid());

(Andriod -> Android).

Not too important but it may happen that someone will copy/paste it (as myself) and will knock his head why it doesn't work!

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.