admin管理员组

文章数量:1426058

I am not able to include . Whenever I load my portlet for the first time it doesn't work but if I refresh the same page then it starts working fine. I don't know what the issue is. Please Help.

I am not able to include http://maps.googleapis./maps/api/js?sensor=false. Whenever I load my portlet for the first time it doesn't work but if I refresh the same page then it starts working fine. I don't know what the issue is. Please Help.

Share Improve this question edited Sep 30, 2011 at 8:20 Yi Jiang 50.2k16 gold badges139 silver badges136 bronze badges asked Sep 30, 2011 at 5:08 rkgrkg 1751 gold badge3 silver badges13 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

One of the clean ways to include js file in a portlet, independent of the portal server is to configure in portlet deployment descriptor file as below. For liferay, it would be liferay-portlet.xml.

<portlet>
    <portlet-name>MySamplePortlet</portlet-name>
    <header-portlet-javascript>http://maps.googleapis./maps/api/js?sensor=false</header-portlet-javascript>
</portlet>

本文标签: How to include JavaScript file in Liferay PortletStack Overflow