Suppose I have an HTML document, that is available at some URL.
Is it generally possible, for most common cases, to determine whether the documented has been loaded at root level of a web view?
The "most common case" here being a web view of an iOS or Android application. It's enough if I can only determine running inside those. This determination process is expected to be possible from JavaScript (mainly because I don't think any other page content can be useful in this).
I only care about the root level of a web view, meaning that if the page is loaded into a frame within a web view, it's a separate handling case.
No help is expected to be provided by web views, i.e. it's a black box web view.
Here is a mock of what I would like to happen:
<script type="text/javascript">
if (window.contentWindow) {
alert("I'm in an iframe");
} else if (inWebView()) {
alert("I'm in a web view");
} else {
alert("I'm most likely in a web browser");
}
</script>
The check can be reversed - instead of testing for whether the container is a web view, I can test if a container is a well known web browser, but then I will need to check for all of them, desktop included.