Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to restrict a website to display only in Android? [closed]

I work in a startup of payment methods technology in the marketing area.

For the past few months I have been learning a little bit of HTML, CSS and some basic Javascript.

Currently I am working on an Android app that enables the users to check their balance online (based off a HTML page).

For security reasons, I want to restrict the website to be sure that the website is only accessible on the Android app (so users will not be able to access the page on desktop).

like image 713
silvialr Avatar asked Jan 06 '17 02:01

silvialr


2 Answers

Yes there are a couple ways around this based on what you are looking to accomplish and how you are rending the page but in your code you can specifically look for a secret post variable that will only run the remote code if that post contains that code. Another way is to have the app generate a specific unique "hash" that is saved to a remote database for that unique device. Then When the app requests a remote file that runs some code it must send this unique identifier that was previously registered only by android devices. that unique key is sent to the server for verification before the remote code can be run.

like image 182
DEVPROCB Avatar answered Sep 30 '22 04:09

DEVPROCB


You can use this JS to check user'OS

var test = navigator.userAgent.toLowerCase();
var isAndroid = test.indexOf("android") > -1;
if(!isAndroid) {
// Do something!
// Redirect to Android-site?
alert(test);
}
like image 24
ThinhLe Avatar answered Sep 30 '22 04:09

ThinhLe