Posts

Showing posts from February, 2012

One-liner to identify mobile apple (iOS) browsers

So, it struck us today, that Apple's mobile browsers does not support file uploads from web sites ( https://discussions.apple.com/thread/3043183?start=0&tstart=0 https://discussions.apple.com/thread/2714162?start=0&tstart=0 https://discussions.apple.com/thread/2659440?start=0&tstart=0 https://discussions.apple.com/thread/3095867?start=0&tstart=0 ). The reason for this, is that the user does not have access to the file system in iOS (no "My documents"), and inter-app communication is severely lacking. Anyway, if you are to design a web site to accommodate iOS users, you might want to hide your file upload control and/or show a friendly message to users using these devices. A one-liner that identifies such a browser is: Regex.IsMatch(Request != null && Request.UserAgent != null ? Request.UserAgent : "", "Mozilla\\/5.0 \\(iPod|iPad|iPhone.+?\\).*?Mobile"); The code snippets expects: That you have referenc