I am writing an application for rails and should provide different links for mobile users to regular web browser users. For example, if the user is on a mobile device, I want to display:
<a href="instagram://user?username=<%= photo.author %>" target="_blank" class="btn btn-info btn-block"><i class="fa fa-instagram"></i> Captured by <%= photo.author %></a>
If the user is in a browser, I want to display:
<a href="http://instagram.com/<%= photo.author %>" target="_blank" class="btn btn-info btn-block"><i class="fa fa-instagram"></i> Captured by <%= photo.author %></a>
What is the best way to do this? Thanks
source
share