Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Output the code without single line and with standard formatting
Hello,
I need to check WCAG 2.1 errors on page but if I read the URL by online tool PowerMapper (and also another tools) there are some wrong code (empty <title> in <body> and not in <head>).
But if we check the code by the browser there are everything ok (<title> tag is not empty and it is in <head>) .
Can we output the code without single line and with standard formatting ?
I need to check WCAG 2.1 errors on page but if I read the URL by online tool PowerMapper (and also another tools) there are some wrong code (empty <title> in <body> and not in <head>).
But if we check the code by the browser there are everything ok (<title> tag is not empty and it is in <head>) .
Can we output the code without single line and with standard formatting ?
You can use ?strip=false to disable the relevant filter.
Thanks, now I see the code without single line but the online validator still download different code, thats unsual ...
Online walidator gets that code:
Online walidator gets that code:
<title></title>
<div id="yui3-css-stamp" style="visibility: hidden !important; position: absolute !important;"></div>
<title>
Welcome
</title>
But browser generate code correctly: <title>Welcome</title>
I can only guess here. Do you have a custom theme? Maybe it reacts badly to some header? Could you try with the standard theme?
You can disable the stripfilter altogether in Liferay. Could you try that and recheck again, maybe the filter breaks something. You can do that by adding the following line to portal-ext.properties
com.liferay.portal.servlet.filters.strip.StripFilter=false
For me, this looks a bit like "autocorrected" html, when a tag is missing, sometimes tools "correct" the html by adding the missing closing (or opening) tags somewhere. And by doing that, they introduce other issues.
You can disable the stripfilter altogether in Liferay. Could you try that and recheck again, maybe the filter breaks something. You can do that by adding the following line to portal-ext.properties
com.liferay.portal.servlet.filters.strip.StripFilter=false
For me, this looks a bit like "autocorrected" html, when a tag is missing, sometimes tools "correct" the html by adding the missing closing (or opening) tags somewhere. And by doing that, they introduce other issues.
Christoph, thanks for reply.
The output HTML code is W3C correct so all <div> etc should be closed correctly. I also make changes with portal-ext.properties but that not help - the code is now without oneline but i see that at the beggining there are some multiple spaces / new lines / tabs etc.
I noticed that YUI script adding wrong code at the top and we have after DOM:
I found some info here about that problem https://github.com/liferay/yui3/pull/21
But after all I just add some jQuery code to remove yui3-css-stamp div $("#yui3-css-stamp").remove(); and now PowerMapper works !
The output HTML code is W3C correct so all <div> etc should be closed correctly. I also make changes with portal-ext.properties but that not help - the code is now without oneline but i see that at the beggining there are some multiple spaces / new lines / tabs etc.
I noticed that YUI script adding wrong code at the top and we have after DOM:
<div id="yui3-css-stamp" style="visibility: hidden !important; position: absolute !important;"></div>
<title>Welcome</title>
I found some info here about that problem https://github.com/liferay/yui3/pull/21
But after all I just add some jQuery code to remove yui3-css-stamp div $("#yui3-css-stamp").remove(); and now PowerMapper works !
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™