留言板

RE: New Liferay installation --> No JavaScript loaded

Stefan L.,修改在14 年前。

New Liferay installation --> No JavaScript loaded

New Member 帖子: 12 加入日期: 09-8-11 最近的帖子
Hi,

I am confused.
I have done a complete new installation of Liferay 5.2.3 with tomcat 6.0 but it seems that no JavaScript is loaded!
Whenever I access the control panel (or something else) a lot of errors are thrown.

JavaScript is enabled in my browser.

Firebug tells me (same errors in IE7 and IE8):

Liferay.Portlet is undefined
[Break on this error] <script type="text/javascript">/*<![CDAT...00" rel="stylesheet" type="text/css" />\ncontrol_...lid=10172 (Zeile 7)
Liferay.Portlet is undefined
[Break on this error] <div class="lfr-panel lfr-component pane...OnExpire:false});/*]]>*/</script>control_...lid=10172 (Zeile 16)
Liferay.Util is undefined
[Break on this error] Liferay.Util.portletTitleEdit=function(){};javascri...213406000 (Zeile 1)
Liferay.Session is undefined
[Break on this error] 
Stefan L.,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 12 加入日期: 09-8-11 最近的帖子
disabling js fast load solves the problem.
javascript.fast.load=false

but WHY?


thx
thumbnail
Ziggy .,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

Expert 帖子: 293 加入日期: 08-6-8 最近的帖子
Do you get the same error on all browsers?
Stefan L.,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 12 加入日期: 09-8-11 最近的帖子
yes, same on following browsers:

IE7, IE8, Firefox 3.5, Firefox 3

peterpaul
thumbnail
Zsolt Balogh,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
Lately we had some issues with the minifier. It removes line breaks from the javascript and it causes errors in some cases for example:

var a = "hello world";
// This is a nice comment
alert(a);


The minifier creates this:
var a = "hello world";// This is a nice comment alert(a);


So the end of the script is commented out.

I'm not sure, that this is your problem, but I needed to share this information emoticon
Stefan L.,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 12 加入日期: 09-8-11 最近的帖子
Should not a javascript minifier remove comments as well as line breaks?
Tom Witmer,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 22 加入日期: 09-7-27 最近的帖子
Zsolt Balogh:
Lately we had some issues with the minifier. It removes line breaks from the javascript and it causes errors in some cases for example:

var a = "hello world";
// This is a nice comment
alert(a);


The minifier creates this:
var a = "hello world";// This is a nice comment alert(a);


So the end of the script is commented out.

I'm not sure, that this is your problem, but I needed to share this information emoticon


I ran into this too, but I'm pretty sure I found the cause, at least in our case. Here's what I learned in case it helps someone else. I'll also open a JIRA issue on this so the Liferay team can address this more deeply in the future. At first, I thought the Yahoo minimizer was the problem, but updating to the latest and greatest minifier made no difference. The problem is actually in the portal code.

In our case, our JS elements began with the following, which resulted in the same end-line comment problem as the above:

<script language="JavaScript" type="text/javascript"></code></pre><br />It turns out the JS was only properly handled if the tags were exactly this:<br /><br /><pre><code><script type="text/javascript"></code></pre><br />The reason is that the StripFilter (com.liferay.portal.servlet.filters.strip.StripFilter) is overly simplistic in what it interprets as JS, and treated everything inside our &lt;script&gt; tags as HTML, not JS. <br /><br />StripFilter does greatly reduce the amount of data sent to the browser, but the algorithm assumes a bit too much about the usage and ordering of optional attributes and spacing. I wouldn&#39;t be surprised if this issue also affected other embedded tags such as CSS, but I haven&#39;t run into that yet.<br /><br />The minimal workaround is to make sure all your portlets use the exact tags required by StripFilter, or to disable StripFilter completely.</script>
thumbnail
Zsolt Balogh,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
Thanks for this, it's a good information.

I've found where the problem is, please comment the issue# and I'll try to create a patch for it.
Tom Witmer,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 22 加入日期: 09-7-27 最近的帖子
thumbnail
Zsolt Balogh,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

Expert 帖子: 463 加入日期: 09-3-23 最近的帖子
I've uploaded a simple patch for the problem.
thumbnail
Paul B.,修改在14 年前。

RE: New Liferay installation --> No JavaScript loaded

New Member 帖子: 18 加入日期: 09-7-29 最近的帖子
Hi,

Maybe you can try placing this line into portal-ext.properties :

com.liferay.portal.servlet.filters.minifier.MinifierFilter=false


But I still don't know the 'why'. The mysteries of Liferay Javascript are still eluding me...