Xhtml Validation Error on Experience editor
Imagine you created your rendering and testing it, but when you open your page in experience editor, you see a red bar that says there is something wrong on the page. This red bar might appear only if you enable validation. Something like this image below:
You might get confused because the component seems working fine, but this error raises a lot of concerns as it is on top of the page and your testers raise concerns that there is something wrong on this page.
First thing to do is to take a look at that url shown on the error page, i.e., https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0365101 . The article shows a few examples which might be the case. So please check those in your code and fix if there is any similar usage of html tags. But what if that is not the case and you still see the error?
I have faced this multiple times and banged my head to cushion a lot(Not wall obviously 😜) and found another cause for this error. This is actually simple but not as per some standard of HTML. Another reason for seeing this error is self-closing html tags.
Its strange, right? Self-closing tags work in all browsers and developers tend to use them in the case of simple html tags. But Sitecore raises a red flag.
Tag that causes error:
<div title="Tag causing error" />
Tag that works and no error:
I write this so that you don't bang your head to cushion :P.
Happy Coding.
Comments
Post a Comment