Joram Clervius
Joram Clervius

Reputation: 179

How can I detect if the webpage is being rendered in WebBrowser Control?

Most of the people who will access my app will do so from a preinstalled software on their pc that has a browser component built with Microsoft's WebBrowser Control which is just Internet Explorer wrapper.

I want to know if there's a way I can detect, using Javascript, or any other method from inside my website, when it is being rended using this wrapper.

The reason I want to do this is that software was already built and goes to the home page of my site. But I want to redirect them directly to the login screen if they are accessing from that wrapper.

Upvotes: 0

Views: 103

Answers (2)

Neo
Neo

Reputation: 3399

I don't think you can do this accurately. As Samuil stated, you can hack it a bit and maybe catch some of it.

Why not set the default page of your website to be the login page so the user goes to that page regardless?

Upvotes: 1

Samuil Petrov
Samuil Petrov

Reputation: 553

By default the WebBrowser Control uses IE7 so you can check the user agent string (I doubt your other users will be using such an old Internet Explorer version as their browser causing a faulty recognition).

However, this is not a perfect solution, if you can modify the preinstalled software and deliver a new version to people that will be using it you can send a specific header along with the request to determine its origin.

Upvotes: 1

Related Questions