Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i want to ask on how to detect browser name that user use to browse my webpage?because i want they use Firefox only..if they are using IE@Chrome i want to block them from viewing.this is because the system is include a print process and they dont want a print dialog.the only way i found the solution is using firefox browser.

so i want to get the browser name first so that if ie@chrome i want to block and if firefox then continue to open the web page.

thanks,
musiw.
Posted
Updated 17-Jun-21 7:25am
Comments
Hemant Singh Rautela 17-May-13 4:06am    
Is this the solution for you (block other browser & work with only one...)...!
surprising..
I think you have to work on print option to print in all browser you can use javascript for this...

Using Request.UserAgent property you can detect browser type below is the sample code

if (Request.UserAgent.ToLower().IndexOf("firefox") != -1) then

Else

End If
 
Share this answer
 
To be short: forget it.
Your intention is somewhat strange.
Still, on server side you have to relay on the data sent by the client, more precisely the User Agent[^] header property. But that can be altered on client side with ease: there are plugins for merely all browsers that users can use to change this property, look at this one for example: http://www.gtricks.com/google-chrome-tricks/change-user-agent-string/[^]
 
Share this answer
 
v3
Comments
musiw 17-May-13 4:56am    
it is..but i already tried to print page without dialog.it is failed.so i change the browser to firefox
Zoltán Zörgő 17-May-13 5:15am    
That's normal, and will go away someday (or it is already configurable) from firefox too. It is a security issue. You should not try to force the user to accept a printing event without he's consent. But if that's the requirement...

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