robbymarston
robbymarston

Reputation: 356

Can you make a webpage accessible only by mobile application?

I'd like to build a webpage and make it viewable only to users of my mobile application (via WebView). Obviously I can use the UserAgent to add some level of 'security' but that can be spoofed with minimal effort. I was wondering if some sort of token system or additional header(s) might do the trick but I suppose if someone could decompile the app it would reveal that code. The information on the webpage isn't private, I'd just prefer for users not to be able to say, "Hey look, I can see the app on my desktop browser!" Any tips are appreciated, thanks!

Upvotes: 1

Views: 2088

Answers (2)

Samrat Das
Samrat Das

Reputation: 1918

I haven't tried, but it may be helpful to know, what to do

you can supply some extra headers in your app using

String url = "address";
Map <String, String> extraHeader = new HashMap<String, String>();
extraHeader.put("Authorization","Bearer");
host.loadUrl(url,extraHeaders);

or any similar method. And in the backend, assume in php, you can access header and check using

$header = apache_request_headers();
foreach ($headers as $header => $value)
{
//access it, compare it
} ?>

when the value is present and same as desired, procced or else give forbidden error.

In this way it can be possible, there are more ways for this, in similar manner.

And if you'll be using these on encrypted SSL https protocol, then it will become harder for anybody to spoof to your webpage.

Upvotes: -1

New2Programming
New2Programming

Reputation: 91

Its possible to create web pages specifically for mobile devices, but its not possible to make them only readable by mobile devices. You could require a certain UserAgent, but those can be easily spoofed and read by non mobile devices.

Upvotes: 3

Related Questions