Its such a pain for me, since I use Google Chrome as my main default browser so everything just works but then later I found that it doesn't work in IE because of some browser compatibility issue or a weird way that IE handle some JavaScript.... The main problem here is that the browser companies (Microsoft, Mozilla etc) doesn't come together and work on a solid JavaScript standard. Ladies & gents, that is the reason why we've language standards!! There is a promise that the next version of JavaScript will be standard accross all browsers but thats only "promises".
For example:
var name = "Lennie";alert(name[0]);
where you want the first characters e.g. "L" but in IE (IE is always the bad child it seams...) it returns "undefined" :-(
So you need to write it:
var name = "Lennie";
alert(name.charAt(0));
this works fine in all browsers.
So something to consider when your coding in JavaScript again.
3 comments:
Actually, the charAt(int pos) instance method is more or less the standard when it comes to OOP and strings. That some browsers support C-style string handling, does not imply that C-Style string handling is the "correct" way to go about.
I'd say that Microsoft and IE scores 1 point on this one with regards to staying on track with OOP standards.
furthermore, Javascript is not PHP ;)
My blog post is about how in-compatible JavaScript is between all the browsers.... and yes even PHP run fine all all the browsers!
Post a Comment