Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
next-useragent
Advanced tools
next-useragent
parses browser user-agent strings for next.js.
$ npm install next-useragent
next-useragent
is simple to use.
Give access to user-agent details anywhere using withUserAgent
method.
getInitialProps
.this.props
Example usage:
import React from 'react'
import { UserAgentProps, withUserAgent } from 'next-useragent'
class IndexPage extends React.Component<UserAgentProps> {
static async getInitialProps(ctx) {
// ctx.ua
// => `UserAgent` type object.
return {}
}
render() {
const { ua } = this.props
return (
<ul>
<li>Original source: { ua.source }</li>
<li>Device Type: { ua.deviceType }</li>
<li>Device Vendor: { ua.deviceVendor }</li>
<li>OS Name: { ua.os }</li>
<li>OS Version: { ua.osVersion }</li>
<li>Browser Name: { ua.browser }</li>
<li>Browser Version: { ua.browserVersion }</li>
<li>is iPhone?: { ua.isIphone ? 'yes' : 'no' }</li>
<li>is iPad?: { ua.isIpad ? 'yes' : 'no' }</li>
<li>is mobile?: { ua.isMobile ? 'yes' : 'no' }</li>
<li>is tablet?: { ua.isTablet ? 'yes' : 'no' }</li>
<li>is desktop?: { ua.isDesktop ? 'yes' : 'no' }</li>
<li>is Chrome?: { ua.isChrome ? 'yes' : 'no' }</li>
<li>is Firefox?: { ua.isFirefox ? 'yes' : 'no' }</li>
<li>is Safari?: { ua.isSafari ? 'yes' : 'no' }</li>
<li>is Internet Explorer?: { ua.isIE ? 'yes' : 'no' }</li>
<li>is Mac?: { ua.isMac ? 'yes' : 'no' }</li>
<li>is ChromeOS?: { ua.isChromeOS ? 'yes' : 'no' }</li>
<li>is Windows?: { ua.isWindows ? 'yes' : 'no' }</li>
<li>is iOS?: { ua.isIos ? 'yes' : 'no' }</li>
<li>is Android?: { ua.isAndroid ? 'yes' : 'no' }</li>
<li>is bot?: { ua.isBot ? 'yes' : 'no' }</li>
</ul>
)
}
}
export default withUserAgent(IndexPage)
next-useragent
is licensed under MIT License.
See LICENSE for more information.
FAQs
next-useragent parses browser user-agent strings for next.js.
The npm package next-useragent receives a total of 11,568 weekly downloads. As such, next-useragent popularity was classified as popular.
We found that next-useragent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.