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 javascript help
Old 08-09-2006, 10:17 AM Browser check javascript help
Novice Talker

Posts: 10
Trades: 0
Hi,
I need the users to have at least Internet Explorer 5.5 to be able to log into my site. So, I have written a javascript to check a users browser before they can login and if the check fails, it unhides text within a DIV that tells the user to update their browser, and should disable the login forms.

I have tested this script by upping the browser version required to 6.5 (i only have 6.0), and when my browser fails, it unhides the text between the DIV tags, but does not lock the login forms. Any clues as to why?


Code:
 
<SCRIPT LANGUAGE="JavaScript1.2">
// Create the function CheckBrowser to disable 
//login forms if the function CheckBrowser2
// gives us problems
function CheckBrowser() {
 if(!CheckBrowser2()){
  document.login_form.username.disabled=true;
  document.login_form.password.disabled=true;
  document.login_form.login.disabled=true;
  document.login_form.reset.disabled=true;
 }
 else{
// Start with the cursor in the user_name field
  document.Form.username.focus(); 
 }
}
function CheckBrowser2() {
// Make sure Internet Explorer is at least version 5.0
 
// Checks if the user is running Microsoft Windows
 if(window.navigator.platform != "Win32"){
  document.getElementById("error_browser").style.display = "block";
  return false;
//Checks if the user is running Microsoft Internet Explorer
 
 } 
 if(window.navigator.appName != "Microsoft Internet Explorer"){
  document.getElementById("error_browser").style.display = "block";
  return false;
 }
 
// Checks if the user is running Microsoft Internet Explorer 5.0 +
 appVer = window.navigator.appVersion;
 pos = appVer.indexOf("MSIE ");
 if(pos != -1){
  pos2 = appVer.indexOf(";", pos + 1);
  appVersion = appVer.substring(pos + 5, pos2) - 0;
  if(appVersion <= 5.5){
   document.getElementById("error_browser").style.display = "block";
   return false;
  }
 }
 return true;
}
</SCRIPT>

Last edited by kw91; 08-09-2006 at 10:19 AM..
kw91 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Browser check javascript help
 

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.08381 seconds with 12 queries