RC 2.0: Archive.aspx and js.axd

Topics: Business Logic Layer
Dec 23, 2010 at 3:04 PM


I have a weird problem with js.axd on the archive.aspx page
This happens on my hosted site using the MySQL db connection, locally I am using XML standard config and I have no problems, other than this both sites should be equal. I will check this later hopefully this evening
I will also change local to use MySQL to see whether I can reproduce or not

Locally I am running XP not sure about my hosting company but I can find out

Scripting error on archive.aspx (in danish):

Brugeragent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6.6; .NET CLR 2.0.50727; .NET CLR 1.1.4322; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)
Tidsstempling: Thu, 23 Dec 2010 16:00:11 UTC

Meddelelse: Object doesn't support this property or method
Linje: 1
Tegn: 1
Kode: 0
URI: http://looksharp.dk/js.axd?path=Scripts%2fblog.js&minify=

Meddelelse: Object doesn't support this property or method
Linje: 165
Tegn: 4
Kode: 0
URI: http://looksharp.dk/archive.aspx
Dec 23, 2010 at 6:44 PM

I took a look, and yes, weird error.  It only happens in IE.  I think I found the reason.  You have a category named BlogEngine.  On the archive page, there's an H2 tag that has an ID of BlogEngine:

<h2 id="BlogEngine">

The reason why you have this H2 tag is because each category on the archive page has its own H2 tag, and the ID of that H2 tag matches the category name.  When the blog.js script is injected, it creates the "BlogEngine" object with all of its functions, etc.  It's the very beginning of the file:

BlogEngine = {

With JS in IE, it automatically makes DOM elements available via their ID.  So via JavaScript in IE, for any DOM element, you could simply write:


Without having to write something like

Back to your archive page ... when the BlogEngine JS object is attempted to be created, IE is trying to assign those properties to the "BlogEngine" H2 tag on your page.  This causes the error since properties & functions like that cannot be assigned to a DOM element (the H2 tag).

Probably the solution here is for us to modify archive.aspx so it doesn't output the category name as the H2 "id" -- at least, not as-is.  We could prefix it with something.

In the meantime, you could try renaming your BlogEngine category to something else, and the error should disappear.

Dec 23, 2010 at 6:55 PM

I confirmed this to be the problem.  I created the same "BlogEngine" category and started receiving the same JS error in IE.

I just checked in that fixes this problem by prefixing the H2 id's with a prefix of "cat-".

Thanks for the report ... a strange one (!), but good to have fixed.

Dec 23, 2010 at 8:02 PM

Thanks - I would never have found that tiny bug in a million years :-)

rgds /Peter