Let's say I have a website that contains only 2 pages.
Then I created a webview react native application it can be simple as this:
App.js
import React, { Component } from 'react';
import { WebView } from 'react-native';
export default class MyWeb extends Component {
render() {
return (
<WebView
source={{uri: 'http://example.com/webview.html'}}
style={{marginTop: 20}}
/>
);
}
}
Now my question is: Is it possible for the webpage to detect that it is accessed from the webview app?
Let's say I have a condition in the webview.html file like:
if ( webview ) {
return 'webview';
}
else {
return 'normal browser'
}
Maybe something like inserting a javascript, maybe a variable from the webview to webpage? Then I can use that variable to check its existence then if it exists then it is webview, else it is not.
I know javascript can detect the browser used, screen resolution, os, and etc. So is this possible?
The app has a target OS of Android and iOS.