userAgent for use in JavaScript

Technical discussion regarding how to implement potential features for a future version. Welcome, Developer friends.

Moderator: SlimBrowser Forum Moderators

Post Reply
Hans
Advanced Member
Posts: 422
Joined: Sat Jul 19, 2003 10:37 pm
Location: Tampa Bay, FL
Contact:

userAgent for use in JavaScript

Post by Hans » Mon Oct 29, 2007 8:11 am

I use RemotelyAnywhere for remote control of my machines. Unfortunately, the IE ActiveX control crashes in SB when I try to go full screen; it works fine in IE, of course. I realize it's unlikely that SB will implement full ActiveX support (it's an IE thing anyway), but what I need is a way to detect the userAgent string, determine if the user is using SB or IE actual to load the webpage, and then use JavaScript to dynamically write the code (if SB, do not write the link to RemotelyAnywhere, and if IE, allow the link to load it.)

So, any ideas? Image Does SB already have a userAgent string that identifies it above and beyond IE? (As of right now, SB will return itself as IE.)

edit: BTW, this is the code I'm using. Copy & paste this to a new html page to see what it does; it you load it in IE (or SB), it will link to the ActiveX control install; if you load the page in FireFox, it will link to the FireFox .xpi control install.

Code: Select all

<HTML> 
<head> 
<script type="text/javascript">
//determines what browser is being used.
//
// Only IE and FireFox are enabled in this script, since that's all I use.
function WhichBrowser()
{
  if (navigator.userAgent.indexOf('MSIE') != -1) {
    document.write('<a target="_parent" href="http://www.remotelyanywhere.com/connect_msie.asp" style="text-decoration: none">RA ActiveX install</a>'); }
  else if (navigator.userAgent.indexOf('Firefox') != -1) {
    document.write('<a target="_parent" href="https://secure.logmein.com/activex/npRACtrl.xpi" style="text-decoration: none">RA FireFox install</a>'); }
  else {
    document.write("Not IE or FireFox.");
  }
}
</script>
</head> 
<body>
<tr><td align="center"><font face="Tahoma" size="2"><script>WhichBrowser()</script></a></font></td></tr>
</BODY> 
</HTML>

Ontornnap
Newbie
Posts: 1
Joined: Wed Sep 02, 2009 5:02 pm
Location: Sierra Leone
Contact:

some user-agent

Post by Ontornnap » Thu Sep 03, 2009 2:05 pm

Anybody know about user-agent "Verticrawlbot"? I'm search it on user agents library - it exist, but no info about.
Some ideas? Tnx.

Post Reply