bjankord / categorizr Goto Github PK
View Code? Open in Web Editor NEWA modern device detection script
Home Page: http://www.brettjankord.com/2012/01/16/categorizr-a-modern-device-detection-script/
A modern device detection script
Home Page: http://www.brettjankord.com/2012/01/16/categorizr-a-modern-device-detection-script/
It would be helpful if device classification could include basic capabilities matrix like "touch, speech, gesture, localstorage, canvas, svg" etc similar to DeviceAtlas. A plugin path for this or a method to add to the $device
object for these would be helpful. I realize that is waaay out of scope for now, but a path to this would be a tremendous addition.
The assumption this script makes is that all sites use PHP's native sessions which isn't true. The script does not need any session code to cache the result.
function categorizr(){
static $result = NULL;
if($result) return $result;
....
(run checks here)
....
$result = 'desktop';
....
return $result;
}
Then if someone happens to want the category saved in the session they can just do this:
$_SESSION['category'] = categorizr();
Hey,
I'm just wondering is this project still active? There's been no activity on it in the last few months and am wondering how up-to-date the regex are.
Thanks,
Pat
Hey @bjankord. I just ported your code to a cross-platform javascript build, though I’ve taken a slightly different approach in some of the API implementation. Check it out and let me know what you think.
https://github.com/bjankord/Categorizr/blob/master/categorizr.php#L83
I think this is wrong as it never returns true for iPad. Shouldn't the FOLIO
check be negated?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.