When you receive a request from iPhone, a βUser Agentβ -String will be sent, for example Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 in the request.user_agent variable. Finding this line for the iPhone may mean that the iPhone is visiting your page.
iframe is an HTML tag to include other pages in your page (for example, this button is used as Facebook). This has nothing to do with a particular browser; all modern browsers support this. You cannot tell on the server side whether your page was called in an iframe or not. You can use some kind of JavaScript in the client to find out if your current page is within the iframe and then send a notification to the server.
It would be best practice to add another parameter to your request, for example ?iframe=1 , and use this parameter in your controller.
source share