Firefox, Javascript and application/xhtml

I noticed a problem when serving the blog as application/xhtml.

I released the Transpose Email plugin which uses a javascript function Transpose_Email().

This function works properly in IE and Opera.

This works perfect in Firefox when the page is served as text/html, but the moment I shift to application/xhtml, I get a javascript error saying function not found.

I have absolutely no idea how to solve this problem so that the function works when the page is served as XHTML.

Any suggestions / solutions?

Following my posting on MozillaZine Forums, I was able to find a solution.
Simply moved the javascript to an external file.

Also realized that when using the comment tags in the inline javascript, the HTML parser was considering it a comment when the page was served as xhtml unlike when served as html.
As a result, the javascript function was thought to be a comment and not a code!

Issue resolved. Happy that my plugin will now work even with stricter web standards 😀

Share this post with your friends!
Ajay
Ajay

I'm Ajay D’Souza — a WordPress developer, blogger, and investment banker. Since 2003, this blog has been my space to share personal stories, travel experiences, and WordPress creations. It's where I document my journey, both online and off.

Articles: 1282

One comment

Comments are closed.