Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Browser check to run separate javascript
Old 08-03-2009, 07:27 PM Browser check to run separate javascript
Junior Talker

Posts: 4
Trades: 0
I've been looking all over for a solution to this so hopefully somebody can point me in the right direction.

I need to check whether the browser is IE or Firefox, then call a javascript file depending on which browser it is.

Here's what I have so far, but it's not executing the script:
PHP Code:
<script type="text/javascript">
function 
getInternetExplorerVersion()
// Returns the version of Internet Explorer or a - 1
// (indicating the use of another browser).
{
   var 
rv = - 1;
   
// Return value assumes failure.
   
if (navigator.appName == 'Microsoft Internet Explorer')
   {
      var 
ua navigator.userAgent;
      var 
re  = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");
      if (
re.exec(ua) != null)
      
rv parseFloatRegExp.$);
   }
   return 
rv;
}
function 
checkVersion()
{

   var 
ver getInternetExplorerVersion();

   if ( 
ver > - )
   {
      if ( 
ver 8.0 )
      
document.write('<scr' 'ipt type="text/javascript" src="ie.js"></script>');

   }
   else if((
navigator.userAgent.indexOf("Firefox") != - 1))
   {
      
document.write('<scr' 'ipt type="text/javascript" src="ff.js"></script>');

   }

}
</script> 
Anybody have a solution for this? Thanks
pnuker is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Browser check to run separate javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08170 seconds with 12 queries