Archived : Techno Babble

This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums

You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}

« Photozoom 3 takes steroidsPlaying with relations »

Internet Explorer - wasting production time worldwide

Posted on 5th Dec 2007 in : Techno Babble

Internet Explorer - wasting production time worldwide

Most people who know me will know my view of any/every version of Internet Explorer, hell most of them hold the same views. In fact, I'd imagine that pretty much every serious web developer out there would probably hold the same views. Internet Explorer is crap, and reminds us daily. Not only can it not understand the most basic HTML or CSS, but it usually can't even understand itself.

Today it hit a new level. I've been coding up a plugin for use on a clients site and, to improve the workflow, we decided to do some fancy shit with javascript seeing as the environment already required javascript to function. After a fair amount of thinking and tinkering I dived in and started coding away in a busy looking manner. After a fair amount of coding, quite a bit of which was spent beating my head against the wall with explorer and coding round it's *quirks* ... but that was expected .... I finally got the code behind the scenes done and started working on the GUI .... I wish I hadn't!

After finding some annoying little quirks ... like don't try leading/trailing whitespace in element title attributes ... ohhh and don't try and make it think to much whilst it's still trying to work out what HTML is .... I hit a deal killer. Internet Explorer couldn't add a radio button ( that worked ) via the DOM ...... a simple bloody radio button! .... if you want to try it yourself, copy paste the following code into notepad, save it as ie_is_crap.html and call it up in IE

Html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-UK" lang="en-UK">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <title>Screen demo</title>
  </head>
  <body>
  <script type="text/javascript">
  // create an element
  function amCreateElement( elementType, elementAttributes )
  {
    // create an element of the required type
    var theElement = document.createElement( elementType );
  
    if( elementAttributes )
    { // we have attributes for this element
      var allAttributes = elementAttributes.split( '" ' );
      var numAttributes = allAttributes.length;
      for( i = 0; i < numAttributes; i++ )
      {  // step though all elements
        attributeName = allAttributes[i].slice( 0,allAttributes[i].indexOf( '=' ) );
        attributeValue = allAttributes[i].slice( attributeName.length + 2 );
        // the last attibute will still have trailing "
        if( attributeValue.charAt( attributeValue.length - 1) == '"' ) attributeValue = attributeValue.slice( 0, -1 );
        // check for onclick et al
        if( attributeName.slice( 0, 2 ) == 'on' )
        {// bugger now we need to play with explorer
          if ( window.attachEvent )
            eval('theElement.attachEvent( attributeName, function(x){ '+attributeValue+' } );' )// IE
          else
            theElement.setAttribute( attributeName, attributeValue );
        }
        else
        {  // rest of attributes
          if( attributeName == 'class' )
          { // yet another piece of explorer crap
            theElement.className = attributeValue;
          }
          else
          {  // note : in iE everything else but style will work
              theElement.setAttribute( attributeName, attributeValue, 0 );
          }
        }
      }
    }
    // return the element we just built
    return theElement;
  }
  
    theInput = amCreateElement( 'input', 'name="test" type="radio"' );
    document.body.appendChild( theInput );
  
  
    theInput = amCreateElement( 'input', 'name="test" type="radio"' );
    document.body.appendChild( theInput );
  
  
  </script>
  </body>
  </html>

Inferior Experience brought to you by Microsoft

Great huh? I won't begin to tell you how many hours I spent narrowing it down to just that. So, this problem leaves us royally screwed, if I can't solve it then we have to revert back to a crap work flow and undo 3 days worth of my time ..... I am not a happy bunny ....... as a last resort I hit google, and for once I was impressed, it's first result leads to this post ( Problem with RADIO (created by DOM) in Internet Explorer ) on a forum, and more importantly, the answer ;) .......... notice the date of the post, July 2005.

Basically it comes down to the fact that IE wouldn't allow you to add a name attribute to an element created through the DOM, because nobody would ever want to create a form object huh? The bit that really pisses me off is that their new *flagship* and *compatible* browser IE7 is just as fucked up, so web developers world wide will still have to waste hours overcoming IE's various quirks and failures ......... I dread to think of the number of hours a day that amounts to.

Thanks to the answer given by Martin Honnen, and the microdoft page that he linked to, I managed to get radio buttons working ..... hooray only 4 bloody hours wasted huh Mr Grates :| for any of you that are interested, just add the snippet below into the code you saved from above and rerun the page ;)

Html:

if( window.attachEvent && elementAttributes && elementAttributes.indexOf( 'type="radio"' ) > -1 )
    { // you REALLY have to hate IE :|
      return document.createElement('<input '+elementAttributes+'></input>' );
    }

A problem shared and all that

As you can imagine, with not being a happy bunny, I had to share my problem with Scott ...... the conversation went a tad like this :

tuxnus: it's ie6 ... it's high time to start penalizing them
yabba_hh: how the fuck do you penalise someone who's using IE6 ? they're ALREADY fucked :|
tuxnus: make it obvious to them ;)
tuxnus: most haven't a clue
yabba_hh: if they haven't noticed just from using ie then even a big red banner with flashing gif saying "Yer browsers fucked" wouldn't work :|
tuxnus: trouble is, most have nothing to compare it to
tuxnus: they think what they see, is what everyone sees
yabba_hh: there's probably a fair amount of truth in that

So ...... for all you IE users out that there that haven't a clue what we're on about, go install an alternative browser like Firefox or Opera ( google them huh ), and then go wander around the web and see what it *really* looks like. Not only will you have a better experience, and be safer because you're not using a browser that has more security flaws than MI5's headquarters, you'll also be helping web developers world wide save production time by not having to code out IE's ineptitudes.

Anyway, it's time I went and finished the GUI
¥

9 comments

Comment by Lurker on 28/12/07
It wouldn't be so funny if it weren't so true.

I attached a radio button dynamically...click...click...click...why won't the little dot appear..?

Thanks for the info.

Cheers
~mike
Comment by ¥åßßå on 28/12/07
Glad it was of some use to you, it took me a fair amount of time to find the solution.

¥
Comment by EdB { @link http://wonderwinds.com } on 28/12/07
WAIT A MINUTE THERE FRIEND. Internet Explorer is the BEST browser ever created. If it wasn't how come it killed Netscape (which today was officially and finally announced as a dead end)? And how come all the other wanna-be browsers can't get even a tiny bit of market share? Gee whiz they GIVE AWAY that "fired fox" thing and still can't get anyone to use it.

I absolutely LOVE Intarweb Exploder! I wish it was the ONLY browser allowed BY LAW!

PS: I also sometimes wish my balls were forcibly removed without anesthesia then re-attached so that they could be forcibly removed without anesthesia again. That simulates the IE experience yah?
Comment by ¥åßßå on 29/12/07
In a nutshell? yes :|

IE6 on the other hand is like having each ball extracted independently .... damn, I'm gonna miss it when it next passes netscape

¥
Comment by Lurker on 07/03/08
I dont normally leave comments, but I just wanted to say "thanks" you just solved an issue that has been biting at me for the past few days. Thanks - Richard
Comment by ¥åßßå on 07/03/08
Glad I could help, finding the original forum post stopped me losing any more hair ;)

¥
Comment by Lurker on 16/10/08
You've saved me a headache. And 25 years of jail for homicide.
Comment by Lurker on 15/01/09
I think that someone ought to make a browser detection scheme from all this. It will be WAY more reliable than using user agent strings alone.

Mind you the system may need a bit of work as the end-user still has to enter things in the fields. But it is not far from exposure!

Microsoft doesn't care about IE anymore! If they did they wouldn't say "we are only improving on some of the standards tested by Acid3" would they?

The only advantage of using Internet Exploder would be you can access Windows Update for Windows 2000/XP.

All I did was disable EXECUTE permission for ALL USERS (including Administrators) to the "%PROGRAMFILES%\Internet Explorer" folder, and then set up a software restriction policy to prevent anything in that folder from executing.

Oh and at one point I got -55 in the Acid3!

Ah Don't you guys love Acid Tests?
Comment by Lurker on 15/01/09
KB1298392183721973921287309182759832647580182746083217493218740932187401932847: Internet Explorer makes end users ignorant.

Workaround:

1. Install Linux
2. Get a Macintosh
3. If you wish to continue using Microsoft Windows, disable Execute permissions on the "C:\Program Files\Internet Explorer" folder


After choosing one of the options, install Opera or Mozilla Firefox.

Applies to:

Pretty much every operating system which has Internet Exploder installed.
Page archived : 11th Nov 2009
 

X