Q:

Check if Page is being Accessed by a Browser vs. HTTP Request

Like the title says, is it possible to detect whether a particular page is being accessed via a web browser as opposed to an HTTP request? I'm aware that accessing via a web browser is performing an HTTP request, so I'm curious if it's at all possible to differentiate.
I ask because I'd like a certain page to only be accessible via my own application and it should not be browsed to directly.

A:

If it's a publicly accessible URL, there's no way to fundamentally differentiate between "your app" and "anybody else". It's only an HTTP request, whichever way you access it. If you set the right headers, there's no way to differentiate one request from another identical one. If you want to limit access to "your app" only, set some specific secret authentication headers which only "your app" knows. However, if "your app" is Javascript in a webpage, anyone will be able to inspect and see those "secret" headers.

