Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want my site to open in IE only.Can it choose the browser on its own???
Posted

Yes: Hvae a look at the HttpRequest.Browser property[^]

Be aware though, that you will severely limit your market / audience if you do that. If you look at the browser statistics[^] you will see that 60% of users will not be able to use your site...
 
Share this answer
 
Comments
Peter_in_2780 5-Jun-12 19:56pm    
With due respect, I don't see how you can avoid user agent spoofing as mentioned in my answer below. It appears to me that the .Browser property is .NET's predigested User-Agent (or am I missing something huge here?)

Cheers,
Peter
OriginalGriff 6-Jun-12 3:10am    
You can use browser spoofing to pretend you are something other than you are, but most users don't know how to.
I wanted to say that it is a silly idea to restrict your site to a single browser (presumably because the OP can't be bothered to test in other browsers). It annoys me when sites only work in IE - my wife has to do computer training on a site that just doesn't work in Chrome and it's a PITA to remember she needs IE to open it.
Peter_in_2780 6-Jun-12 3:25am    
I totally agree. M$ in particular has a bunch of stuff that just fails in mysterious ways if you use FF or Chrome.
My original reply was meant to point out that forcing a particular browser is impossible. And, as you pointed out, pointless.

Cheers,
Peter
Short answer: NO.
Your code can examine the User-Agent header in the HTTP request and make some decisions based on the content, but that is not foolproof by any means. The HTTP requester (browser, spider, wGet, etc, etc) can build a User-Agent header containing whatever it wants, ans as an HTTP responder, your site has to take it on trust. Google or check Wikipedia[^] for "User Agent Spoofing"

Peter
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900