I have this requirement:
From my application I send a user an email link to open the applicat开发者_运维技巧ion. When the user tries to open the link in any browser other than IE or Firefox it should not open.
I am using VS 2005, c#, asp.net, javascript
How can we achieve this?
Any help would be great.
You can't run JavaScript inside of an email, so you can not stop it at the email level.
However, on the link destination you could do something according to their user agent.
I don't think you can do this as you can't stop the link from being launched, and it will launch in the users default browser, except by checking the user agent on the server and not generating the page if the user agent isn't on a white list of allowed user agents (and instead generating a 'This client is not supported' page instead, or similar)
You could instead blacklist certain agents if you only wanted to disallow certain ones rather then only allow certain ones.
Expending from alex's answer. You could set the hyperlink in the email to navigate to checkbrowser.aspx. Here you could perform your javascript checks using
navigator.appVersion
Be careful though as javascript isn't always 100% actuate.
Hope this helps.
Reposting here since it is a duplicate:
<!--[if IE]>
<a href="real_link_for_ie_users.html">You have a browser I have decided to support</a>
Here you can also have content for IE
<![endif]-->
<![if !IE]>
I apologise, but for some reason you are using a browser that I have decided not to support
<![endif]>
精彩评论