The approach using user agent looks like this: