2005-01-19

Pop up ad

Well, I've learned alot with this.
I spent a long long time trying to find some javescript standards document. I came up with ECMAScript and the W3C DOM. I still couldn't find anything, but the closest thing I found to a formal reference that had exactly what I wanted was this page on MSDN (yuck). Even more yuck when I realized the Firefox JavaScript Console (which I had already fired up to run my script through) came up with this:

Error: unterminated character class
Source File: http://msdn.microsoft.com/workshop/code/browdata.js
Line: 26, Column: 31
Source Code:
else if (this.userAgent.match(/Mozilla[/].*(95[/]NT|95|NT|98|3.1).*Opera.*(\d+)\.(\d+)/))

Scary.
Well anyway, yeah, all I wanted was a formal list of all those attributes you can specify, and while I am fairly sure some of them are IE-only, it did well enough.
Anyhow, I used that list to come up with something, and I placed it in a seperate file, to be loaded in the "head" part of my document, and the one-line function in it was to be called by the onload attribute of "body."
I load it in firefox, and since I had my site in the popup exception list (I was worried for a moment when it popped up, then I remembered the list.) it popped up. Only problem I could see is that there was too much padding above and below (making the right side invisible) and that there was too much space below it (the MSDN thing did say that "height" should be at least 100, so I guess maybe it wasn't lying. So I realized I needed to tweak those two, and maybe adjust ad.html to pad it less. Best of all, no errror in the JavaScript console.
Anyway, now for the reason I am writing this before I am done. I'd like to say that MSIE officially sucks alot. I hate it when people say they use IE all the time just because it shows "every site" and some that others don't. I hate it even more when people say they don't give a shit if it doesn't work in any sane browser, so long as it works in IE.
Get this: Firefox displayed it perfectly, MSIE didn't show sh*t. That's right. There was nothing, just whiteness. The title was there on the titlebar, but none of the document. I checked a few things, and then I nearly fell off my chair laughing when I realized why it wasn't working. IE's XML parser sucks d*ck.
Let me show you the code I used to load the external Javascript file: (keep in mind that this is within the head element of a perfectly XHTML 1.0 Strict compliant document)
<script src="ad.js" type="text/javascript" />

So lets see, the validator accepted it, and any XML-knowing person will tell you that when you have an element with a slash like that at the end, it means that that tag closes itself, and there is nothing inside the element, just the attributes (this eliminates my XML obligation to have a seperate closing tag after it, like </script> - those are MANDATORY in ALL cases (including stuff like br and hr) unless the opening tag closes itself, the way I did)). The f*ck*ng retarded XML parser in IE translated my beautiful code to mean this:
  • Opening stuff-like clearly specifying that we are dealing with XML here, as governed by the XHTML 1.0 Strict DTD
  • open tag of html element-OK
  • open tag of head element-OK
  • other info in head, like the title (which it got right) and loading my CSS stuff
  • script stuff (in detail below)
    • "<" get ready we have a tag coming
    • "s" OK, now we know it must be an opening tag, since its not started with a /
    • "cript " OK, we've got a script element, lets see if there are any attributes
    • "src='ad.js' " I think I'll just pretend that's not there (OK-to tell the truth, I don't really know. It's very possible that it did actually load it. Chances are it did, actually, but I can't find out with this example. Maybe I will. Bottom line is, if IE is "so good at guessing what the author means" wouldn't you think that it wouldn't expect to see inline javascript after this?
    • "type='text/javascript' " OK-javascript
    • "/>quot; - I think I'll just forget that there is a / and act as if it didn't close itself, by processing everything after this as javascript until i hit a </script>
  • rest of document-perfectly coded end head tag, a nice body, and end of html - IE sees it all as javascript- sh*tt**st javascript I've ever seen

IE SUCKS! DIE!
Now I'm tempted to leave it like this and explain to Mr. LaVancha that I did do my project, but his f*ck*d up sh*t web browser can't notice valid XHTML when it runs into it.
Fags at microsoft.
LONG LIVE THE MOZILLA PROJECT. LONG LIVE THE WORLD WIDE WEB CONSORTIUM. TIM BERNERS-LEE IS COOL. BILL GATES LIKES MEN.
/rant

0 Comments:

Post a Comment

<< Home