组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Stefan L.
New Liferay installation --> No JavaScript loaded
2009年8月26日 上午12:15
答复

Stefan L.

等级: New Member

帖子: 12

加入日期: 2009年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):

1Liferay.Portlet is undefined
2[Break on this error] <script type="text/javascript">/*<![CDAT...00" rel="stylesheet" type="text/css" />\ncontrol_...lid=10172 (Zeile 7)
3Liferay.Portlet is undefined
4[Break on this error] <div class="lfr-panel lfr-component pane...OnExpire:false});/*]]>*/</script></html>control_...lid=10172 (Zeile 16)
5Liferay.Util is undefined
6[Break on this error] Liferay.Util.portletTitleEdit=function(){};javascri...213406000 (Zeile 1)
7Liferay.Session is undefined
8[Break on this error] <div class="lfr-panel lfr-component pane...OnExpire:false});/*]]>*/</script></html>


The server logs seem to be OK.

Any ideas what i am missing?

thx
peterpaul
Stefan L.
RE: New Liferay installation --> No JavaScript loaded
2009年8月26日 上午1:43
答复

Stefan L.

等级: New Member

帖子: 12

加入日期: 2009年8月11日

最近的帖子

disabling js fast load solves the problem.
javascript.fast.load=false

but WHY?


thx
Ziggy ©
RE: New Liferay installation --> No JavaScript loaded
2009年8月26日 上午4:25
答复

Ziggy ©

等级: Expert

帖子: 293

加入日期: 2008年6月8日

最近的帖子

Do you get the same error on all browsers?
Stefan L.
RE: New Liferay installation --> No JavaScript loaded
2009年8月26日 上午4:36
答复

Stefan L.

等级: New Member

帖子: 12

加入日期: 2009年8月11日

最近的帖子

yes, same on following browsers:

IE7, IE8, Firefox 3.5, Firefox 3

peterpaul
Zsolt Balogh
RE: New Liferay installation --> No JavaScript loaded
2009年8月26日 上午7:43
答复

Zsolt Balogh

LIFERAY STAFF

等级: Expert

帖子: 463

加入日期: 2009年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:
1
2var a = "hello world";
3// This is a nice comment
4alert(a);


The minifier creates this:
1var 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
Paul B.
RE: New Liferay installation --> No JavaScript loaded
2009年8月26日 上午8:10
答复

Paul B.

等级: New Member

帖子: 18

加入日期: 2009年7月29日

最近的帖子

Hi,

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

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


But I still don't know the 'why'. The mysteries of Liferay Javascript are still eluding me...
Stefan L.
RE: New Liferay installation --> No JavaScript loaded
2009年8月27日 上午4:39
答复

Stefan L.

等级: New Member

帖子: 12

加入日期: 2009年8月11日

最近的帖子

Should not a javascript minifier remove comments as well as line breaks?
Tom Witmer
RE: New Liferay installation --> No JavaScript loaded
2009年10月8日 上午8:58
答复

Tom Witmer

等级: New Member

帖子: 22

加入日期: 2009年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:
1
2var a = "hello world";
3// This is a nice comment
4alert(a);


The minifier creates this:
1var 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:

1<script language="JavaScript" type="text/javascript">

It turns out the JS was only properly handled if the tags were exactly this:

1<script type="text/javascript">

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 <script> tags as HTML, not JS.

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't be surprised if this issue also affected other embedded tags such as CSS, but I haven't run into that yet.

The minimal workaround is to make sure all your portlets use the exact tags required by StripFilter, or to disable StripFilter completely.
Zsolt Balogh
RE: New Liferay installation --> No JavaScript loaded
2009年10月8日 上午9:25
答复

Zsolt Balogh

LIFERAY STAFF

等级: Expert

帖子: 463

加入日期: 2009年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
RE: New Liferay installation --> No JavaScript loaded
2009年10月8日 上午9:31
答复

Tom Witmer

等级: New Member

帖子: 22

加入日期: 2009年7月27日

最近的帖子

Zsolt Balogh
RE: New Liferay installation --> No JavaScript loaded
2009年10月8日 下午12:18
答复

Zsolt Balogh

LIFERAY STAFF

等级: Expert

帖子: 463

加入日期: 2009年3月23日

最近的帖子

I've uploaded a simple patch for the problem.