Image for post
Image for post

Sharing in the World of the in-app Web View

Alastair Coote
Feb 17, 2015 · 3 min read

The mobile web is weird in a myriad of ways, but one of the weirdest things about it is that if you have a lot of social traffic, your users aren’t actually viewing your mobile web site in a browser. Well, not quite. On iOS (and sometimes Android) they are in a web view, housed inside the Facebook or Twitter apps. After looking at this chart from Flurry you could be forgiven for assuming that the web is entirely dead:

Image for post
Image for post
via Flurry: http://www.flurry.com/bid/109749/Apps-Solidify-Leadership-Six-Years-into-the-Mobile-Revolution

when in reality, people’s web usage is shifting from Safari to Facebook. (Unfortunately, only Facebook knows how much time is spent inside app views vs. web views, so we can’t draw any conclusions about the death of the web… yet.)

So what?

This is especially important as many of these apps will hook into the share buttons on your site and show the native interface, not the web version. Just compare Twitter to Tumblr:

Image for post
Image for post

User agent to the rescue

Mozilla/5.0 (iPod touch; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 Safari/600.1.4

to that of Facebook:

Mozilla/5.0 (iPod touch; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Mobile/12B411 [FBAN/FBIOS;FBAV/24.0.0.12.7;FBBV/6890242;FBDV/iPod5,1;FBMD/iPod touch;FBSN/iPhone OS;FBSV/8.1;FBSS/2; FBCR/;FBID/phone;FBLC/en_US;FBOP/5]

and Pinterest:

Mozilla/5.0 (iPod touch; CPU iPhone OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12B411 [Pinterest/iOS]

In amongst all that insanity, you’ll see that both networks have added some custom text of their own that we can detect.

Even when they don’t

Put it all together

and then use CSS classes on the <body> tag to change which share buttons we show.

In conclusion

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store