Pigdogmonster
asked on
Various Browser checks
Hi, Thanks for looking at my question, any idea's/comments are appreciated.
I am developing a login page to an online application and I would like to check the following information on the clients browser:
1. They must be using i.e. 6 or up?
2. Cookies must be enabled (as I'm using sessions)
3. Javascript must be enabled
4. Also, I'm not sure if this is even possible but, is there a way of checking to see if the user's browser has the Check for newer version of stored pages' set to 'Every visit to the page''
If any of the above checks come back as false I would like to DISABLE my Username and password inputs.
Most of the applications I have developed have all been in-house so I've not had to worry which browser version etc as they have all been the same so this is a little different for me!
Are there any other standard checks that I have missed out that i should be doing?
Many thanks for your time.
PDM
I am developing a login page to an online application and I would like to check the following information on the clients browser:
1. They must be using i.e. 6 or up?
2. Cookies must be enabled (as I'm using sessions)
3. Javascript must be enabled
4. Also, I'm not sure if this is even possible but, is there a way of checking to see if the user's browser has the Check for newer version of stored pages' set to 'Every visit to the page''
If any of the above checks come back as false I would like to DISABLE my Username and password inputs.
Most of the applications I have developed have all been in-house so I've not had to worry which browser version etc as they have all been the same so this is a little different for me!
Are there any other standard checks that I have missed out that i should be doing?
Many thanks for your time.
PDM
2:
// cookie.js file
/* (c) 1999-2007 Michel Plungjan javascripts(at)planet.nl
unless otherwise stated */
today = new Date();
expiryDate = new Date(today.getTime() + (365 * 86400000));
function isCookieEnabled() {
if (document.all) return navigator.cookieEnabled;
setCookie('testcookie',tod ay.getTime ());
var tc = getCookie('testcookie');
delCookie('testcookie');
return (tc == today.getTime());
}
/* Cookie functions originally by Bill Dortsch */
function setCookie (name,value,expires,path,t heDomain,s ecure) {
value = escape(value);
var theCookie = name + "=" + value +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((theDomain) ? "; domain=" + theDomain : "") +
((secure) ? "; secure" : "");
document.cookie = theCookie;
}
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { // if there are any cookies
var offset = document.cookie.indexOf(se arch)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
var end = document.cookie.indexOf("; ", offset)
// set index of end of cookie value
if (end == -1) end = document.cookie.length
return unescape(document.cookie.s ubstring(o ffset, end))
}
}
}
function delCookie(name,path,domain ) {
if (getCookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-70 00:00:01 GMT";
}
// cookie.js file
/* (c) 1999-2007 Michel Plungjan javascripts(at)planet.nl
unless otherwise stated */
today = new Date();
expiryDate = new Date(today.getTime() + (365 * 86400000));
function isCookieEnabled() {
if (document.all) return navigator.cookieEnabled;
setCookie('testcookie',tod
var tc = getCookie('testcookie');
delCookie('testcookie');
return (tc == today.getTime());
}
/* Cookie functions originally by Bill Dortsch */
function setCookie (name,value,expires,path,t
value = escape(value);
var theCookie = name + "=" + value +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((theDomain) ? "; domain=" + theDomain : "") +
((secure) ? "; secure" : "");
document.cookie = theCookie;
}
function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { // if there are any cookies
var offset = document.cookie.indexOf(se
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
var end = document.cookie.indexOf(";
// set index of end of cookie value
if (end == -1) end = document.cookie.length
return unescape(document.cookie.s
}
}
}
function delCookie(name,path,domain
if (getCookie(name)) document.cookie = name + "=" +
((path) ? ";path=" + path : "") +
((domain) ? ";domain=" + domain : "") +
";expires=Thu, 01-Jan-70 00:00:01 GMT";
}
1,2,3:
<script src="cookie.js"></script>
<script>
agt = navigator.appVersion.toLow erCase();
var iePos = agt.indexOf("msie");
var is_ie = ((iePos !=-1) && (agt.indexOf("opera") == -1));
if (is_ie) {
is_minor = agt.substring(iePos+5,agt. indexOf('; ',iePos))
is_major = parseInt(is_minor)
}
var is_ie6up = (is_ie && (is_major >= 6));
if (!is_ie6up) {
document.write('Please use IE6+');
}
else if (!isCookieEnabled()) {
document.write('Please enable cookies');
}
else document.write('<input type="text" name="userid" value=""><br><input type="password" name="password" value="">');
</script>
<noscript>
Please enable javascript
</noscript>
<script src="cookie.js"></script>
<script>
agt = navigator.appVersion.toLow
var iePos = agt.indexOf("msie");
var is_ie = ((iePos !=-1) && (agt.indexOf("opera") == -1));
if (is_ie) {
is_minor = agt.substring(iePos+5,agt.
is_major = parseInt(is_minor)
}
var is_ie6up = (is_ie && (is_major >= 6));
if (!is_ie6up) {
document.write('Please use IE6+');
}
else if (!isCookieEnabled()) {
document.write('Please enable cookies');
}
else document.write('<input type="text" name="userid" value=""><br><input type="password" name="password" value="">');
</script>
<noscript>
Please enable javascript
</noscript>
4 cannot be detected but you can expire the page using meta tags or server settings
PS: 50 points?
PS: 50 points?
ASKER
Hi Mplungan, thank you.
Is there a way I can make the elements in my form disabled, something like..
document.FORMNAME.username .disabled = true;
document.FORMNAME.password .disabled = true;
document.FORMNAME.button.d isabled = true;
}
</script>
Is there a way I can make the elements in my form disabled, something like..
document.FORMNAME.username
document.FORMNAME.password
document.FORMNAME.button.d
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
agt = navigator.appVersion.toLow
var iePos = agt.indexOf("msie");
var is_ie = ((iePos !=-1) && (agt.indexOf("opera") == -1));
if (is_ie) {
is_minor = agt.substring(iePos+5,agt.
is_major = parseInt(is_minor)
}
var is_ie6up = (is_ie && (is_major >= 6));
alert(is_minor+'\n'+is_maj
'\n'+is_ie6up)