简体   繁体   中英

Modernizr detect Flash vs User Agent for Mobile/Tablet - Opinions wanted

I need to redirect to one of two options, either a mobile area which is fully HTML5 but is optimized for small screen or the regular version which may contain some flash but is optimized for bigger screens.

The Modernizr JavaScript library has a option to detect weather a the current browser has flash Modernizr.on(feature,cb); . I was thinking this would this be a better way to check if a device is an ipad/mobile device but if it's a desktop browser has flash disabled this would probably also send the user to the mobile optimized area, instead of sending them to the desktop area with a Flash player blocked error if they do reach a flash object, which would be the preferred behavior.

Would a better way be to check the User Agent or if the browsers supports Touch Events?

Does any one have any opinions on best way to go about this?

For my situation I ended up using User Agent detection over feature detection. This is because the section I need to send the user to would give desktop user a lower quality experience. However I feel the feature detection would still be a preferable way to go but within the end area. All flash element can rather be removed there and the html5 object can be optimized there rather.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM