Forum Moderators: open

Message Too Old, No Replies

Done, but with errors on the page

error message on IE6

         

Dave McClure

11:09 am on Sep 29, 2004 (gmt 0)

10+ Year Member



I am consistently getting this error message in the bottom left corner of IE6 when browsing my own site. The line number varies, but the message is always the same.

Line: 15
Char: 1
Error: Object expected
Code: 0
url:http://www.mydomain.com/folder/file.htm

Most of my pages contain this javascript, intended to autodirect random hits to the index page -

<SCRIPT LANGUAGE="JavaScript">
<!--
if (top == self) self.location.href = "index.htm";
// -->
</SCRIPT>

Everything works, but I don't like the error appearing. Is the problem with the javascript, because that is the only common content. Hope someone can help - thanks!

Birdman

11:24 am on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello,

Welcome to Webmaster World!

It looks like your site uses frames, right? The script looks like it is supposed to put users back in the frameset if they came into a content page without the frame.

In any case, try changing it to this:

<SCRIPT type="text/javascript">
<!--
if (top == self.parent) self.location.href = "index.htm";
// -->
</SCRIPT>

Birdman

Dave McClure

12:00 pm on Sep 29, 2004 (gmt 0)

10+ Year Member



Hi Birdman -
Thanks for the welcome and the fest reply. I tried changing the javascript, but it has the effect of bringing up the frameset inside itself so I changed back. One strange thing is that I get no error messages when browsing the local image of the site in a folder on my own machine, but only when browsing on the web. I don't see why that should make a difference?

Birdman

12:47 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, sorry about that. I wasn't thinking straight :(

Try this instead:

<SCRIPT type="text/javascript">
<!--
if (top!= self.parent) self.location.href = "index.htm";
// -->
</SCRIPT>

I think I had it backwards!

kaled

9:47 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Using location.replace(url) is better insofar as the history and back button will work as expected.

Scrapping the language attribute and replacing it with type="text/javascript" may help. Does the page validate? A stray open tag above the script may cause problems.

Just a few thoughts,

Kaled.

Dave McClure

10:29 am on Sep 30, 2004 (gmt 0)

10+ Year Member



Thanks, both, for your help. In fact, the problem turned out to be elsewhere, in carelessly written html. The validator page found lots of missing " " pairs. IE6 is pretty forgiving, because it all worked in spite of the error message, but mozilla was struggling a bit.