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

PhantomJS is not detected correct #28

Closed
dignifiedquire opened this issue Apr 6, 2013 · 9 comments
Closed

PhantomJS is not detected correct #28

dignifiedquire opened this issue Apr 6, 2013 · 9 comments

Comments

@dignifiedquire
Copy link

Given the following user agent string:

Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.6.0 Safari/534.34

This is the result

{ family: 'Safari',
  major: '0',
  minor: '0',
  patch: '0',
  source: 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.6.0 Safari/534.34' }

But it should be

{ family: 'PhantomJS',
  major: '1',
  minor: '6',
  patch: '0',
  source: 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.6.0 Safari/534.34' }
@3rd-Eden
Copy link
Owner

3rd-Eden commented Apr 7, 2013

Thanks for reporting it! Just not sure if we should detect it as browser or as device. Because it is actually running a safari instance. But it runs it headless.

@dignifiedquire
Copy link
Author

I would argue for browser as it is the program that is running and not the physical device. Also it is not Safari that PhantomJS uses but rather QTWebkit 1 so features do not map 1:1 with Safari. 

On Sun, Apr 7, 2013 at 4:05 PM, Arnout Kazemier notifications@github.com
wrote:

Thanks for reporting it! Just not sure if we should detect it as browser or as device. Because it is actually running a safari instance. But it runs it headless.

Reply to this email directly or view it on GitHub:
#28 (comment)

@dignifiedquire
Copy link
Author

I've looked a little bit more into it and the following works:

// lib/regexps.js
parser[0] = new RegExp("(PhantomJS)/(\\d+)\\.(\\d+).(\\d+)");
parser[1] = "PhantomJS";
parser[2] = 0;
parser[3] = 0;
parser[4] = 0;

But only if it's inserted before the Safari matcher 126.

@3rd-Eden
Copy link
Owner

3rd-Eden commented Apr 7, 2013

Ill make sure its added in the next release

Twitter: @3rdeden
Github: @3rd-Eden

On Sun, Apr 7, 2013 at 5:59 PM, Friedel Ziegelmayer
notifications@github.com wrote:

I've looked a little bit more into it and the following works:

// lib/regexps.js
parser[0] = new RegExp("(PhantomJS)/(\\d+)\\.(\\d+).(\\d+)");
parser[1] = "PhantomJS";
parser[2] = 0;
parser[3] = 0;
parser[4] = 0;

But only if it's inserted before the Safari matcher 126.

Reply to this email directly or view it on GitHub:
#28 (comment)

@dignifiedquire
Copy link
Author

I really would like to start using this in karma. If you tell me at which location you want the new regexp I can make a PR out of it.

@3rd-Eden
Copy link
Owner

@dignifiedquire i'll add it today together with support for the IE string. I'll release it in 2~ hours

@dignifiedquire
Copy link
Author

@3rd-Eden Thanks! That was quick :)

@3rd-Eden
Copy link
Owner

Released as 2.0.4

@dignifiedquire
Copy link
Author

Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants