Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

IE Syntax Error - Help Needed

xmlns error, line 2.



12:06 pm on Aug 31, 2006 (gmt 0)

10+ Year Member

I've just changed to look of my website. However when viewing in IE I get the following error on page:

Line: 2
Char: 1
Error: Syntax Error
Code: 0
URL: http://www.example.com/blah

The top 2 lines on all my pages is:

<!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">

So, I look in Dreamweaver and use the 'browser error report'. It says 'the XMLNS attribute of the HTML tag is not supported, but has no detrimental effect'.

It may not have a detrimental effect, but it doesn't look good to have 'error on page' at the bottom left of the IE browser. Therefore, I replace the top of the code with:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

I still get the error on page message. Any ideas?


[edited by: encyclo at 12:26 pm (utc) on Aug. 31, 2006]
[edit reason]
[1][edit reason] switch to example.com [/edit]


12:22 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I think this is a javascript error - ignore the Dreamweaver warning (though you prob. should be using HTML4.01 rather than XHTML). Do you have a script on the page? If so, what is line 2 etc?


12:36 pm on Aug 31, 2006 (gmt 0)

10+ Year Member

Thanks for the quick reply.

Line 2 in the code is:

<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/productpage.dwt" codeOutsideHTMLIsLocked="false" -->

I do have some javascript in the head section:

<script type="text/javascript">
function cPop(url, windowname, wide, high)
{window.open(url,windowname,'width=' + wide + ',height=' + high);

This is just for some informational pop ups. I don't think this is the problem though, as I had it before the latest update.

The only thing I have really changed with the site is the left hand navigation system. Rather than have a long list of 60+ products, I put the navigation as categories using a simple HTML list with CSS styling.

What I really don't understand is that when i remove the 'line 2' and replace it without the XHTML it still says there is an error on line 2.

I appreciate your help.



1:34 pm on Aug 31, 2006 (gmt 0)

5+ Year Member

Your quotation marks appear to be misplaced in your JavaScript:

window.open(url,windowname,'width=' + wide + ',height=' + high

should be
window.open(url,windowname,width=' + wide + ',height=' + high + '

I think


2:18 pm on Aug 31, 2006 (gmt 0)

10+ Year Member

I've changed the javascript as suggested, but still no joy.



7:09 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

The error is definitely for line 2 OF THE SCRIPT ITSELF (or whatever line # the message indicates) -- the html is not the issue. Besure you've saved the javascript in a plain text editor so there are no hidden characters. Or perhpas, there is an earlier line that is actually line #2?

By the way, the original script above (which I recognize from our own generic javascript [webmasterworld.com] thread appears accurate. The single quotes go around the actual text which is going to be written out by the script, but not around the function's parameter names.


7:58 pm on Aug 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

As has been stated earlier, the error is a javascript error. These can sometimes be misleading.

For instance, the URL part of the error message will always indicate the main HTML page, even if the error occurs in an external javascript file. Do you have any references to external javacript files in your page? (the line number is for the line in that external file where the error occurs.)

Also, just to be sure, the URL indicated in the error message is for the main page, and not for the url that is opened by the popup window, right? I ask this to be sure that the url being opened in the popup is not the source of the error.

As tedster pointed out, the script you originally posted is correct. The third parameter of the window.open method should be one string, which is what you had. However, I would strongly suggest that you use some hard-coded values for the width and height until you have resolved this problem:

Does the error appear before you ever call the function? How is the function being called? You may need to post some more of the actual code. The bottom line is that some portion of your javascript has an error.


9:41 am on Sep 5, 2006 (gmt 0)

10+ Year Member

Thanks for your help. I have now resolved this issue.

As suggested, the problem was javascript. It was the following line just after the <body> tag:

<script language="JavaScript" src="/track.php?pid=auto"></script>

This line is for my PPC tracking, which I have been using for a couple of years, with no problems. I don't know why it gave the errors because I had not changed anything with it. But I'm now using Google Analytics for tracking, so I've deleted this line from the site.

Once again, thanks for helping me.




Featured Threads

Hot Threads This Week

Hot Threads This Month