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

My name is Ajay D’Souza and I’m a blogger and WordPress developer who has a passion for creating and sharing. I also have a professional career as an Investment Banker.

Articles: 1282

One comment

Comments are closed.