The userAgent helper extends the Web Request API with additional properties and methods to interact with the user agent object from the request. Middleware.js import { NextResponse, userAgent } from ‘next/server’ export function middleware(request) { const url = request.nextUrl const { device } = userAgent(request) const viewport = device.type === ‘mobile’… Continue reading userAgent in nextjs