The if condition below I think it says - if the browser is IE and IE browser version is newer than 9, but I don't have IE 9 to test it so it is hard to know the correct output, also this is not 100% of what I want bcos this script should be ran on other browsers too by default like Chrome, Firefox, etc - is it possible to set it in the if condition?
if ($.browser.msie && parseInt($.browser.version) > 9)
{
// run this code
}
The reason why I want to use if condition is that the script appears to have error on IE 7 and of course the best thing is to fix the script but I cannot tell which part of the script that IE doesn't accept it (all other browsers work perfectly fine!). Do u know any tool I can use to debug the script for IE 6, 7, 8, etc? I am using notepad++ to write my jquery, etc, so it doesn't provide any debug stuff...
So, my next best solution is not to run this script if it is IE browser which is older than 9.
By the way, this is the error message display on the IE7 browser but I can never understand it!
Line:910 //which line?
Char:4 // what the hell is this?
Error: Object doesn't support this property or method //what?
Code: 0 // 0 of what?
URL: http://localhost/mysite/page-1 // so which file is causing the error then? the .js or .html or something else??
bloody IE!
thanks.
Instead of putting in a bunch of inline javascript you could just add an empty div for the version of ie you are targeting, so put the following at the top of your html, just inside the body tag:
Then you can place an if statement in your jquery to check for that block.
Here is the Javascript version to test if the browser is IE:
This method is useful in case You are using HTML5 specific modules and want to implement some fallback functions in case the browser not supporting those features, for ex.
<canvas>
I found cascading it works great for multibrowser detection. This code was used to change a fade to show/hide in ie 8 7 6.